AltME groups: search
Help · search scripts · search articles · search mailing listresults summary
world | hits |
r4wp | 25 |
r3wp | 229 |
total: | 254 |
results window for this page: [start: 101 end: 200]
world-name: r3wp
Group: All ... except covered in other channels [web-public] | ||
eFishAnt: 31-May-2008 | I do remember it being simpler than this. There is the old thing about stuff can be before or after the REBOL script where it is embedded into things, and REBOL can find it and run it. Maybe it was REBOL scripts embedded in .html that way...at the time I saw the scripts I thought it was cool, but I think it was simpler than RSP | |
btiffin: 6-Jan-2009 | I want Joe the Plumber to be a home rebol. REBOL is one step away from allowing normal people access. This hit me when I was showing how easy REBOL was to a construction boss. How they could be masters of their own domain. They lit up like a christmas tree. A few days later a $10,000.00 entry caused one of their little scripts to fail. The lights went out, and instead of embracing becoming a home business script writer, they felt stupid, and when I tried to reexplain the use of tick versus comma, they just got pissed off and will never be budding REBOL home users. All of us here could handle 001101010110110110110110010101 and eventually get the machine to do what we want. I'm aiming to open our favourite little engine so grandma could use it to write grocery lists and then little VID charts etc, etc. If we keep that to ourselves, well, IMHO, REBOL will wallow in the usage numbers counted in hundreds not millions as I believe it could. I could be wrong, but REBOL is too close to being usable by non-programmers to let this slip by without at least griping once every 2 months or so. :) In my little warped world, the REBOL console could be the home users "application framework". Every inch closer to common text usage could add an untold number of people by making them feel enabled. Less geek, more people. Again, I'll admit, I could be wrong; maybe the art of scripting will always be for nerds. | |
btiffin: 6-Jan-2009 | Well, technically the design does allow for more international usage; and that IS a good thing, but North Americans use commas. I'll quiet down after this post and then repost to the issue in a few months. I don't know really, but I feel a few small incremental changes could open up the field to more people not inclined to be programmers. On a grander scale, for linguistics work ala Icon's power, being able to LOAD %somerandompoem.txt and not worry about syntax errors could open up a whole new domain for REBOL. That would require a junk! datatype, and sure there will be issues with correctness, but let the english majors worry about those. Today they won't even bother to start, so there are no issues of correctness as there are no scripts. But imagine some English professor or a theologist; LOAD %kingjames.txt and then using REBOL to do statistical analysis, right at the console. A report could count how much non-REBOL data was in the books along with counting the times 'Moses was mentioned in 2 or 3 simple lines of code. I'll stop dreaming now (for a awhile) and get back to the task of being a nerd. S'alright. ;) | |
GrahamC: 12-Jan-2012 | There are a ot of things that should be done but aren't. All the librarians can do is track the various sites and attempt to mirror the scripts. We have lost whole sites in the past ... | |
Group: Ann-Reply ... Reply to Announce group [web-public] | ||
ChristianE: 16-Jun-2009 | PREBOL set aside, I really think IMPORT/CHECK is the common case and one of the main advantages over a simple DO - preventing circular imports and such. I would be deeply surprised if Carl opts for INCLUDE (or #INCLUDE or whatever it will be) not having that check functionality in the standard case, switched off by a refinement. But that's just me and I certainly don't have any extensive build scripts ... | |
Group: RAMBO ... The REBOL bug and enhancement database [web-public] | ||
[unknown: 5]: 24-Nov-2006 | I do it all the time to optimize my scripts these days | |
Group: Core ... Discuss core issues [web-public] | ||
Louis: 16-Oct-2005 | Geomol, let me see what I can do myself first. I like to know what is happening in my scripts. | |
Rebolek: 12-Dec-2005 | Because I'm writing scripts on more than one computer I need to sync files somehow. I can use flashdisk for synchronization, but USB is not always available or I forget my flashdisk at home, so it's not always the right option. Or I can use ftp to upload and download files. But at the end I've got lots of different directories with different versions, because I have no intelligent file structure. I was inspired by Google filesystems for win and lin so I decided to use some freemail (gmail preferably) for my scripts maintaing. Unfortunatly, Gmail needs some authentication, SSL or what and SSL under Rebol needs Command and Command needs 350$ to buy. So I found another freemail provider that offers both non-authenticated SMPT and POP and therefore is OK for REBOL (btw. remeber the old REBOL example? send [luke-:-rebol-:-com] read http://www.rebol.com? Hard to do with all the authetications required today.) and I started coding. The result is a small application called %rspace.r that can upload file to repository, download newest version from repository, or you can get list of all files in repository and finally, if you're happy with your script, you can publish it on www/ftp. All this with documentation in less than 6kB. All you need is REBOL and mail account cappable of SMTP/POP without authentication. It's good to have an FTP account for publishing files but that's not required. If you do not have an mail account, I've set up one on seznam.cz, user 'rebolspace' and pass 'spacerebol' for testing this application (it's built in, so you can start testing right after download). Remember, it's just alpha, does not have many features, but it works, I can write something here, update it there and have all the versions accesible from everywhere. It's written for REBOL scripts so with big projects it's going to be very slow and unusable, but for small project (and most REBOL scripts are really small) it's probably good. So download it form http://krutek.info/rebol/rspace.r(stable) or http://rebolspace.sweb.cz/rspace.r(latest published version). WARNING: because [rebolspace-:-seznam-:-cz] is open account it won't be wise to use it ordinarily. Please, if you like it, set up your own account and use it instead of built-in one. And remember: all suggestions and fixes are welcome. | |
Pekr: 27-Dec-2005 | Ladislav - one more - can you imagine subinterpreter? e.g. you have kind of rebol interpreter master server in your school, then you have students, global context gets cloned for them and all they do they can do like in normal rebol, just that their scripts are executed in subcontext :-) hmm, maybe it would be easier to launch new interpreter for them anyway ... :-) | |
Graham: 19-Apr-2006 | That is what I do .. my scripts up a listen port, and if they can't, they know an instance is already up and running. | |
Sunanda: 17-Jul-2007 | According to Gabriele, REBOL never frees memory -- ie never hands it back to the operating system. That means (I think) freed / garbage collected memory is kept in REBOL's grasp for reallocation, so subsequent allocations are faster than ones that need to go to the opsys. But the memory footprint of an application can be higher than you'd expect -- especially (say) if you do a lot of memory intesmive work at start up: that memory will stay allocated to REBOL throughout the life of the application. One way to avoid that may be to use CALL to run parts of the application under another process. Or perhaps use a webserver and split the app into several non FastCGI scripts. *** I've no idea if R3 does allow for opsys memory handback. It would be a useful option to have: recycle/for-real | |
Geomol: 28-Jul-2007 | I guess, the confusion come from back, when the term "script writer" popped up first, in the '70 or earlier. Script writers were the ones, who wrote scripts (e.g. shell scripts), which were typically small pieces of code to be run in the shell on large computers (mainframes). Those scripts did operating system maintenance and called programs. Programs were written in languages as C, COBOL, etc.. So you had a clear distinguish between a script writer and a programmer. What we do today with REBOL is more often the programmers job (I think), even if it's called a script language. | |
btiffin: 7-Sep-2007 | Graham; To quickly get all the colours, try rebol [] do-thru http://www.rebol.org/library/scripts/capture.rcapture on help tuple! capture off colors: copy [] parse to block! find get-captured newline [ some [set col word! (append colors col) word! tuple!] ] ;; This will fail, no context print disarm try [get first colors] ;; Now bind the words to the REBOL context bind colors 'red print get first colors | |
PatrickP61: 19-Sep-2007 | While doing a google search on "Rebol AS400" I came across this entry dated Nov 19th 1999: One of the best aspects of REBOL is that it is supported on over 35 platforms, with support for 50 or more platforms expected by the end of the year. One of those platforms, fortunately, is the AS/400...With the strength of REBOL’s cross-platform support, REBOL scripts will run exactly the same way on the AS/400 as they do on any other platform, so you can start REBOL programming before the final release of the AS/400 version... --Chuck Lundgren I work on an AS/400 and would like to get more info on this ability. Anyone know of any updated info for Rebol and AS/400? | |
Henrik: 14-Dec-2007 | ah yes, but it doesn't work if you 'do other scripts inside that script. I guess I'll figure out some other method. | |
BrianH: 15-Dec-2007 | Or is the script creating some functiona and objects and returning so the caller can use them, then being reloaded by the caller to do this all over again? I wrote a server application in 2000 that acted that way, with scripts migrating the data from the previous incarnation still in memory. | |
RobertS: 1-Apr-2008 | Diss'ing IDE's might alienate some Smalltalk folk. I cannot imagine maintaining an application suite such as I deal with everyday without an IDE. I just wish it was not eclipse ... Of course only wimps used a Disk Operating System and real men code in machine codes only ... and real pro's dictated their SNOBOL punch cards to lovely assistants ... and ANT scripts are for sissies. Some must have ridiculed Tcl, Expect and TK in their day ... but if my IDE can facilitate my efforts to systematically (key word there) shrirnk company''s codebase as it becomes more reliable with better test coverage then maybe a refactoring browser would be a good tool after all. Even better if it is an integrated part of the IDE, as in Dolphin Smalltalk or Squeak Smalltalk or Smalltalk/X or Cincom Visual Smalltalk. Not that I couldn't survive on grep and diff's. But once the codebase is too large for any one person to author or maintain on their lonesome, a tool that remebers what you did last and where can be a god-send. If you want to know hell without an IDE join an actuarial department working in APL. There you don't even know if they have talent: you just hope most of it works as each quarter rolls around and try to survive year-end. But you know they're smart, cuz after all, they're actuaries - and look at all that APL code in all those files ... of course a few of them look back wistfully at their student days in C with Borland's decent IDE. REBOL [ File: %vid-usage.r Date: 09-Jan-2004 Title: "VID Usage" Purpose: "VID Usage Tutorial with Runnable Examples" Version: 1.2.1 Author: "Cybarite" Edits: RobertS Source: { Based on %easy-vid.r by Carl Sassenrath. Clips from various sites including email that are attributed in the section } library: [ level: 'intermediate platform: 'all type: [tutorial] domain: [gui] tested-under: [view 1.2.8.3.1 on W2K] support: none license: none see-also: none ] ] flash "Fetching image..." read-thru/to http://www.rebol.com/view/demos/palms.jpg%palms.jpg read-thru/to http://www.rebol.com/graphics/reb-logo.gif%rebo-logo.gif read-thru/to http://www.rebol.com/view/bay.jpg%bay.jpg pic: %palms.jpg unview customer: make object! [ ; this sets a default customer object in case the user does not push the samples in order name: "Rosetta Stone" date-of-birth: 14-March-1959 ] stylize/master [text-note: txt maroon bold] ; this sets a default for users who run the samples out of order ; polished is an image that is embedded in this script file ; so that no outside files need to be loaded. ; This technique is used in many of the REBOL samples polished: load #{ 89504E470D0A1A0A0000000D49484452000000670000003808020000006FFB71 8C0000001374455874536F667477617265005245424F4C2F566965778FD91678 0000039B49444154789CCD9BD14E2B310C44F3FFFF521E2AC1C395E00589EF02 5DD8D226713C339EECBD928510A4893D3EF67AB76D7B7E79FEB2D73FAFBDBD1D 36FEEBAF7DBF70FEDABABD0D56F0E1B6E0B6FED7AE81050B2E4F97AF9FED6185 45022048CA2C6920361F1336580B35A63C4E4F12808D378124CE9C81880B186C 14175A1DE9C0C2A2E785B6B64CA62EF6C626330250A932064CB984F3358FA77F BC7F8CD657685E5FB03415A34B9E3226C1484A1ACA6DB6974597699EFB6C2F4E C44B92E17454A309F14F348DDD4D5B98195BB2AF6B7E4E545B57FEBAE0415DA0 43EFE62C70B196362285D74C35F0782ECF26A0FC8492E20EAAED6CC35ACE13FC 61646467C69D5715EA4F9D3725B1703BF45AB2768A9D5F59CA6E716E5A747CBF 23D6A7E418C2C53C6EB440FCE803B106E6D94C8AAF4B42694871B9FB237035C8 70E5A0200D4A7E4553E952A6F435BA247DD4B83A5DB18D26AA4D5E39E0CA4107 7B0F86C7F19EC685B5EFE57D28E02E411CC2238C0304B5065D26DCC1DA9A02FC CE4EBD19A0C58D9BE039179086B6DB20519A1F5C8194071DBB115703B996FF37 4BE0F5AA269B18CFC9C6CC1FC3D5A0D6B62C6AEA112236F38195B88DF12F9C9B B45B1C6C637B161E1D5BCF6D8807A0437366CB21D90462F2BD3E827C96CB0483 D67B99916407E99E69FD12F46A50C973856268A5DC345259837D8827E00FF890 452D0B5D0D38932F3C65B9614B4F720901B96565DCCBD7236B7C66B650868D08 9BFA26EBB36DCAA5E3B120339E5EBE3B468E6B68FB3041E79229047367ADDC14 F7B376F26B2722024A41998813A04CB91A475C11C9054536473CA3F7365C0D30 9E65A0BA6D5977CFEE030BD626B9E2E5DFE76E51AFF9CADA6308F899C76E756A 03D4796E80532E986D273B71CEA8D81672739E0F1B329F8E999D0D9D04080769 CABC1D21260C2BB8E43D2A9D70BE3A2207D66EA09E5BCAFFB742F9F0A0C37677 222CFE9B7C2865192B3FAC5988E0385747334BD8288041E0DFBF4F2AD44804B4 6DADAF2BE98C5D02458059B3571CA91481B09580A9D6E827B184DD3756D6BF7E 7376F81ED59E46633384296A9A4BA7D4E3B8CBD3E566F1948B754731E0EBC41B 246774BD7BBBCA612D8CA7CC85A7C1ED093B75721DCED1D7E279871668830AE7 B782F5E9FDE4918360C9F666A6F61647F2EDB342A2FA3F6E9B0C8AC2699B9B3F 53847BB992B5707FDE5B6D721EA3EB55E3D8190D8BD998923A68917BE3FEDD32 EE1BDCA216275C1CCFBD0A07F35A40A6CC05A1357E6BF512D26DC470BAC927A3 B0078A42DD22E10000000049454E44AE426082 } content: {VID Usage - REBOL Visual Interfaces ===Updates --01-Apr-2008 * Fixed oddity with last item on stylesheets which was locking up some versions of VIEW ---09-Jan-2004 * Fixed slider initialize. * Focus section was not parsed out. --- fixed * Fixed some text errors for the parsing of === ---07-Jan-2004 * Revived vid-usage.r * added more examples from the script library * manage source as vid-usage.leo an outliner file ---12-August-2001 Added supply examples. See: !List/Supply !List With Supplied Data !Supply List With Scroll ---13-August-2001 !Add Subpanel example ported by Anton ===Caveats ---Work In Progress This is a work in progress. Whether the progress will continue depends on the feedback. ---All Rights Reserved The work is based on the documentation of REBOL View provided by REBOL Technology and its mailing list. All rights to this documentation remain the property of REBOL Technology. ---Plagiarized Examples Things are shamelessly plagiarized. There are many experts on the mailing list whose work is included here; most notably the examples from the REBOL documentation. ---Approach The approach that this document uses is to use REBOL/View/VID to demonstrate its abilities and give a visual tutorial. To enable this some changes have been made to the core %easyvid.r program from Carl Sassenrath. A scoll bar was added to the right pane because it was just too difficult to constrain the examples to the screen real estate that was available. ---Order Order The order of the items needs some work. The easyvid presentation approach today does not allow for the drilling down and expansion of an outline tree which is needed for a large amount of documentation. The preferred approach is to put a multi-level tree for navigation purposes and then allow navigation up and down the tree. ===To Do * make this a true outline tree * re-organize it better * update as requested and as possible by suggestions on AltME's REBOL world under group EasyVID * correct numerous flaws * better scrolling implementation using the updates that have been used in other examples such as Didier's %delete-email.r * allow clipping to clipboard like AltME does on a row for the source examples ===Introduction to VID With REBOL/View it's easy and quick to create your own user interfaces. The purpose of this tutorial is to teach you the basic concepts or REBOL/View interfaces in about 20 minutes. VID is REBOL's Visual Interface Dialect. A dialect is an extension of the REBOL language that makes it easier to express or describe information, actions, or interfaces. VID is a dialect that provides a powerful method of describing user interfaces. VID is simple to learn and provides a smooth learning curve from basic user interfaces to sophisticated distributed computing applications. ---Creating VID Interfaces VID interfaces are written in plain text. You can use any text editor to create and edit your VID script. Save your script as a text file, and run it with REBOL/View. !Note: Using a word processor like Word or Wordpad is not recommended because files are not normally saved as text. If you use a word processor, be sure to save the output file as text, not as a document (.doc) file. Recommendation: Look at TextPad from http://www.textpad.com ===Minimal VID Example Here is a minimal VID example. It creates a window that displays a short text message. Only one line of code is required: view layout [text "Hello REBOL World!"] You can type this line at the REBOL console prompt, or save it in a text file and run it with REBOL. If you save it as a file, the script will also need a REBOL header. The header tells REBOL that the file contains a script. Here is an example of the script file with a header: REBOL [Title: "Example VID Script"] view layout [text "VID Example!"] You can also add buttons and other gadgets to the script. The example below displays a text, list of files, and a button: view layout [ h2 "File List:" text-list data read %. button "Great!" ] !Click on the examples above to see how they will appear on your screen. Click on their close box to remove them. All of the examples that follow can be viewed this way. ===Window Management The code that displays the examples also shows how to manage the number of windows that are open. Look at the show-example block in the code near the end of this script. The location of the example window is also managed here by keeping track of the co-ordinates for the sample. After the sample window is moved, the next use will open at the same location. ===Pre-loaded Images For this script, the image which represented a Portable Network Graphic definition of an image is held in the script and loaded. For a small number of graphics, this can achieve some packaging and performance benefits. The image "polished" is used through the script to achieve the polished steel look that is one the outer frame. backtile polished orange button 200x50 "Polished Steel Look" polished ===Two Basic Functions Two functions are used to create graphical user interfaces in REBOL: VIEW and LAYOUT. The LAYOUT function creates a set of graphical objects. These objects are called faces. You describe faces with words and values that are put into a block and passed to the LAYOUT function. The VIEW function displays faces that were previously created by LAYOUT. The example below shows how the result of the LAYOUT function is passed to the VIEW function, and the interface is displayed. view layout [ text "Layout passes its result to View for display." button "Ok" ] Click on the above example to view it. !Note: the block provided to a layout is not normal REBOL code, it is a dialect of REBOL. Using a dialect makes it much easier to express user interfaces. ===Styles Styles describe faces. The examples above use the text and button styles to specify a text line and a button. REBOL has 40 predefined face styles. You can also create your own custom styles. Here are a few example styles: view layout [ h1 "Style Examples" box brick 240x2 vtext bold "There are 40 styles built into REBOL." button "Great" toggle "Press" "Down" rotary "Click" "Several" "Times" choice "Choose" "Multiple" "Items" text-list 120x80 "this is" "a list" "of text" across check radio radio led arrow below field "Text Entry" ] The words like backdrop, banner, box, text, and button are styles. ===Facets Facets let you modify a style. For instance, you can change the color, size, text, font, image, edge, background, special effects, and many other facets of a style. Facets follow the style name. Here is an example that shows how you modify the text style to be bold and navy blue: view layout [txt bold navy "Facets are easy to use."] The words bold and navy are not styles. They are facets that modify a style. Facets can appear in any order so you don't have to remember which goes first. For example, the line above could be written as: view layout [txt "Facets are easy to use." navy bold] Many facets that can be specified. Here is an example that creates bold red text centered in a black box. view layout [txt 300 bold red black center "Red Text"] You can create facets that produce special effects, such as a gradient colored backdrop behind the text: view layout [ vtext bold "Wild Thing" effect [gradient 200.0.0 0.0.200] ] ===Custom Styles Custom styles are shortcuts that save time. When you define a custom style, the facets you need go into the new style. This reduces what you need to specify each time you use the style, and it allows you to modify the look of your interface by changing the style definitions. For example, here is a layout that defines a style for red buttons. The style word defines the new style, followed by the old style name and its facets. view layout [ style red-btn button red text "Testing red button style:" red-btn "Test" red-btn "Red" ] So, if you wanted to create a text style for big, bold, underlined, yellow, typewriter text: view layout [ style yell tt 220 bold underline yellow font-size 16 yell "Hello" yell "This is big old text." yell "Goodbye" ] ===Master Stylesheet REBOL holds its styles in a master stylesheet. When you are sure that you want to share them without having to add the style sheet line then do it as follows: First add the style to the master sheet: button 200x50 "Define text-note as maroon bold text" [stylize/master [ text-note: txt maroon bold ]] button 200x50 "Define text-note as white italic text" [stylize/master [ text-note: txt white italic ]] Then invoke it: view layout [ across size 200x200 return text-note "This shows a master stylesheet style in use." return text-note "This shows another usage of the same style." return text-note "If you want to see the other style displayed, click the Add Style section again and then use the other button" ] ===Note About Examples !From this point forward, all examples will assume that the view and layout functions are provided. Only the layout block contents will be shown. To use these examples in your scripts, you will need to put them in a layout block, as was shown earlier. For example, code that is written as: view layout [button red "Test it"] will now appear as: button red "Test it" ===Face Sizes The size of a face depends on its style. Most styles, such as buttons, toggles, boxes, checks, text-lists, and fields, have a convenient default size. Here are some examples. button "Button" toggle "Toggle" box blue field text-list If no size is given, text will automatically compute its size, and images will use whatever their source size is: text "Short text line" text "This is a much longer line of text than that above." image %palms.jpg You can change the size of any face by providing a size facet. The size can be an integer or a pair. An integer specifies the width of the face. A pair specifies both width and height. Images will be stretched to fit the size. button 200 "Big Button" button 200x100 "Huge Button" image %palms.jpg 50x50 image %palms.jpg 150x50 ===Color Facets Most styles have a default color. For example the body of buttons will default to a teal color. To modify the color of a face, provide a color facet: button blue "Blue Button" h2 red "Red Heading" image %palms.jpg orange Colors can also be specifed as tuples. Each tuple contains three numbers: the red, green, and blue components of the color. Each component can range from 0 to 255. For example: button 200.0.200 "Red + Blue = Magenta" 200 image %palms.jpg 0.200.200 "Green + Blue" Some face styles also allow more than one color. The effect of the color depends on the style. For text styles the first color will be used for the text and the second color for the background of the text: txt "Yellow on red background" yellow red banner "White on Navy Blue" white navy For other styles, the body of the face is the first color, and the second color will be used as its alternate. button "Multicolor" olive red toggle "Multicolor" blue orange ===Layout Commands To drop user interface elements on the canvas according to VIDs directional layout controls ---Across You are placing elements in a row orientation across return button "A" button "B" button "C" return button "D" button "E" button "F" ---Below You are placing elements in a column orientation below return button "A" button "B" button "C" return button "D" button "E" button "F" ---Mix You can mix the directional controls across return button "A" button "B" below button "C" across button "D" button "E" button "F" ---Padding The pad keyword creates extra padding between styles. It uses a pair or integer value. When it is an integer, spacing is created either horizontally (across) or vertically (below). When it is a pair, the spacing will be created both horizontal and vertically. The following example illustrates both uses. First, the buttons "one" and "two" are padded with an integer representing 40 pixels in one direction. Then the buttons "three" and "four" are padded with a pair representing 40x40 pixels. across button "one" pad 40 button "two" return button "three" pad 40x40 button "four" Padding can be negative. backtile polished orange pad 200x200 button "A" pad -100x-100 button "B" ---Guide A guide is a virtual alignment control title "Buttons Without A Guide" button "one" button "two" return button "three" button "four" return button" five" button "six" With an implicit guide location title "Buttons With An Implicit Guide Location" guide button "one" button "two" return button "three" button "four" return button" five" button "six" With an explicit guide location across title "Buttons With An Explicit Guide Location" guide 55x100 button "one" button "two" return button "three" button "four" return button" five" button "six" ===Tabstops Tabs can be used for alignment. ---Across tabs 200 ; sets tabs every 200 pixels across button 20 "A" tab button 20 "B" tab button 20 "C" tabs 100 ; sets tabs every 100 pixels return button 20 "D" tab button 20 "E" tab button 20 "F" ---Below tabs 200 ; sets tabs every 200 pixels below button 20 "A" tab button 20 "B" tab button 20 "C" tabs 100 ; sets tabs every 100 pixels return button 20 "D" tab button 20 "E" tab button 20 "F" ---Explicit Settings Tabstops can be set at explicit values tabs [100 124 166 212 300] across tab button 20 "A" tab button 20 "B" tab button 20 "C" tab button 20 "D" ===Color Facets Most styles have a default color. For example the body of buttons will default to a teal color. To modify the color of a face, provide a color facet: button 200 blue "Blue Button" h2 red "Red Heading" image polished orange Colors can also be specifed as tuples. Each tuple contains three numbers: the red, green, and blue components of the color. Each component can range from 0 to 255. For example: button 200.0.200 "Red + Blue = Magenta" 200 image polished 0.200.200 "Green + Blue" Some face styles also allow more than one color. The effect of the color depends on the style. For text styles the first color will be used for the text and the second color for the background of the text: txt "Yellow on red background" yellow red title "White on Navy Blue" white navy For other styles, the body of the face is the first color, and the second color will be used as its alternate. button 200 "Multicolor" olive red toggle 200 "Multicolor" blue orange From the mailing list, there was a problem reported in changing button color: view layout [ b: button "New color" [ b/color: random 255.255.255 show b ] ] And the answer was that the gradient of the color was preventing this change from working: style color-changing-button button 0.0.0 ; new style overwrites gradient effect b: color-changing-button "New color" [ b/color: random 255.255.255 show b ] ===Text Facets Most faces will accept text to be displayed. Even graphical faces can display text. For example, the box and image faces will display text if it is provided: box blue "Box Face" image polished "Image Face" Most button faces will accept more than one text string. The strings will be shown as alternates as the face is selected. button 200 "Up" "Down" toggle 200 "Off" "On" rotary 200 "Red" "Green" "Blue" "Yellow" choice 200 "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" text-list 200 "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" When other datatypes need to be displayed as text, use the form function to convert them first: button 250 form now field form first read %. ===Normal Text Style Normal text is light on dark and can include a number of facets to set the font, style, color, shadow, spacing, tabbing, and other attributes. text "Normal" text "Bold" bold text "Italic" italic text "Underline" underline text "Bold italic underline" bold italic underline text "Big" font-size 32 text "Serif style text" font-name font-serif text "Spaced text" font [space: 5x0] Text also includes these predefined styles: title "Title" 200 vh1 "vh1" vh2 "vh2" vh3 "vh3" vh4 "vh4" label "Label" ===Document Text Style Document text is dark on light and can also include a number of facets to set the font, style, color, shadow, spacing, tabbing, and other attributes. txt "Normal" txt "Bold" bold txt "Italic" italic txt "Underline" underline txt "Bold italic underline" bold italic underline txt "Big" font-size 32 txt "Serif style text" font-name font-serif txt "Spaced text" font [space: 5x0] Document text also includes these predefined styles: title "Centered title" 200 h1 "Heading 1" h2 "Heading 2" h3 "Heading 3" h4 "Heading 4" tt "Typewriter text" ===Text Entry Fields Text input fields accept text until the enter or tab key is pressed. A text input field can be created with: field To make the field larger or smaller, provide a width: field 30 field 300 Fields will scroll when necessary. Larger amounts of text can be entered in an area. Areas also accept an enter key and will break lines. area You can also specify the area size: area 160x200 To force the text in an area to wrap rather than scroll horizontally, provide the wrap option: area wrap ===Text Setting To set the value of a text field under program control, use /text: e.g. across backtile polished return t1: txt 200 "This is some original text" return f1: field 200 "Some field text" return a1: area {Some original area text.} wrap 200x80 return button 200 "Change Text" [ t1/text: "Some different text" f1/text: "Some new field text" a1/text: {Some wrapping text in the^/ area field to^/ show that this^/ is supported} show [t1 f1 a1] ] ===Text Lists Text lists are easy to create. Here is an example. text-list "Eureka" "Ukiah" "Mendocino" You can also provide it as a block: text-list data ["Eureka" "Ukiah" "Mendocino"] Almost any type of block can be provided. Here is a list of all the files in your current directory: text-list data read %. Here is a list of all the words REBOL has scanned: text-list data first system/words ===Scrolling Text List A style to allow maintenance of lists from Brett Handley on the REBOL list: style updatable-text-list text-list with [ update-slider: does [ sld/redrag lc / max 1 length? head lines ] ] tl: updatable-text-list 300x100 data copy system/locale/months button 300x20 "Delete first entry on the list" [ remove tl/data tl/update-slider show tl ] button 300x20 "Append the 'now' timestamp to list" [ append tl/data mold now tl/update-slider show tl ] ===Text List Picked Values list-of-letters: text-list "a" "b" "c" "d" "e" button 200 "Pick Item 3" [ clear list-of-letters/picked append list-of-letters/picked pick list-of-letters/data 3 show list-of-letters ] ===Images By default an image will be scaled to fit within a face. image 60x60 polished image polished red Images can be framed in a number of ways: image 100x100 polished frame blue 5x5 image 100x100 polished bevel image 100x100 polished ibevel 6x6 Most other faces can accept an image as well as text: box 100x100 polished button "Button" polished purple toggle "Toggle" polished blue red field bold "This is a field." polished effect [emboss tile] field bold "This is another field." polished effect [brighten 100] The image can be provided as a filename, URL, or image data. ===Backdrops A backdrop can be a color, an effect, an image, or a combination of the three. For example a backdrop color would be written as: backdrop navy title "Color Backdrop" gold To create a backdrop effect provide it on the line: backdrop effect [gradient 1x1 0.0.100 100.0.0] title "Gradient Backdrop" gold A backdrop image can be a file, URL, or image data: backdrop polished title "Image Backdrop" red The backdrop image can be colorized: size 400x500 backdrop polished blue title "Blue Image Backdrop" The image can include an effect: backdrop polished effect [fit gradcol 1x1 100.0.0 0.0.250] title "Gradient Image Backdrop" ===Backtile To make a backdrop use a tile effect there are two options: backdrop polished effect [tile] banner "This shows a backdrop with a tile effect" or backtile polished banner "This demonstrates backtile" Note the difference between: size 400x500 backdrop polished banner "Here one image is stretched to cover the canvas" and size 400x500 backtile polished banner "Here one image is repeated to cover the canvas" ===Effect Facets A range of effects are supported for faces. All of these effects are performed directly on the face when it is rendered. Here are examples of a few possible effects in top to bottom then left to right order: style polished-steel image 80x60 polished polished-steel effect [flip 1x1] polished-steel effect [rotate 90] polished-steel effect [reflect 1x1] polished-steel effect [crop 0x50 120x60 fit] polished-steel effect [grayscale] polished-steel effect [invert] polished-steel effect [difference 200.0.0] polished-steel effect [tint 80] return polished-steel effect [contrast 50] polished-steel effect [brighten 50] polished-steel effect [sharpen] polished-steel effect [blur] polished-steel effect [colorize 204.0.0] polished-steel effect [gradcol 1x1 150.0.0 0.0.150] polished-steel effect [gradmul 0x1 0.100.0] polished-steel effect [grayscale emboss] Effects can be used in combination to create other interesting results. However, keep in mind that the computations are performed in real time. If complex combinations are required, a temporary image should be created with the to-image function. ===Actions An action can be associated with almost any face. To do so, follow the face style with a block: button "Test" [alert "test"] The block is used as the body of a function that is passed the face and the current value (if the face has one). For example: toggle "Toggle" [alert form value] rotary "A" "B" "C" [alert form value] text "Click Here" [alert face/text] If a second block is provide, it is used for the alternate actions (right key): button "Click Here" [view/new layout [txt "action"]] [view/new layout [txt "alt-action"]] Use variables to modify the contents or state of other faces. For example, the slider will update the progress bar: slider 200x16 [p1/data: value show p1] p1: progress !More action on actions needed... ===Show After the state is changed for a user interface element, it must be re-drawn to be reflected on the user interface canvas. Accomplish this with the show message. backtile polished across toggle "Toggle State" [ cybernetics?/data: not cybernetics?/data show cybernetics?] return label "Are you interested in cybernetics?" cybernetics?: check One show command can be used for multiple user interface elements backtile polished orange across b1: check label "Red" return b2: check label "Green" return button 200 "Change State But No Refresh" [b1/data: not b1/data b2/data: not b2/data] return button "Show" [show [b1 b2]] ===Hide A user interface element can also be hidden. backtile polished orange across c1: check hide-button: button "Hide" [hide c1] return show-button: button "Show" [show [c1 d2]] The show-button action tries to show a user interface element 'd2' that does not exist. REBOL/View ignores these. ===Invisible Faces To make a button invisible when the view is opened, you can define an invisible button style This approach sets the show? value to false when the user interface element is initialized. across style invisible-button button with [append init [show?: false]] late-shower: invisible-button "I'm Here" return return button 200 "Show Invisible Button" [show late-shower] This works for the other visible user interface element. ===Focus A user interface element can programmatically be given the focus. across backtile polished button 200 "Set focus to Phone Field" [focus f2] return label "Name: " f1: field 100 return label "Phone: " f2: field 100 return button 200 "Remove focus from Phone Field" [unfocus f2] return button 200 "Hide the Phone Field" [hide f2] return ---Focus Defect !Note that the tab function shows a hidden field. I have assumed that this is a defect. If a field is hidden, the tab button should not make it visible. This has been previously sent to feedback. ===Radio Buttons A radio button is used to make a choice between mutually exclusive values. Your preferred programming language is REBOL or C++ or PL/1 or APL but it is only one of those. across backtile polished radio of 'programming-language pad 0x-4 label "REBOL" return radio of 'programming-language pad 0x-4 label "C++" return radio of 'programming-language pad 0x-4 label "PL/1" return radio of 'programming-language pad 0x-4 label "APL" return To mix two groups of radio buttons on one screen, associate them with their groups using the "of 'word". In the above, the grouping is 'programming-language. across backtile polished radio of 'programming-language pad 0x-4 label "Language: REBOL" return radio of 'programming-language pad 0x-4 label "Language: C++" return radio of 'editor pad 0x-4 label "Editor: TextPad" return radio of 'editor pad 0x-4 label "Editor: Notepad" return The padding in the above is needed to keep the label aligned with the radio button. across backtile polished orange radio of 'programming-language pad 0x-4 label "REBOL" return radio of 'programming-language label "APL" return ===Radio Button Settings A radio button is not very useful unless you can find out what its setting is and change that setting under program control. across backtile polished orange rebol-radio: radio of 'programming-language [programming-language: 'rebol] pad 0x-4 label "REBOL" return apl-radio: radio of 'programming-language [programming-language: 'apl] label "APL" return button 200 "Toggle radio button" [ apl-radio/data: not rebol-radio/data: not rebol-radio/data show [rebol-radio apl-radio] ] ===Check Box ---Purpose A check box is used to allow user interface choices where the choices are not mutually exclusive. across backtile polished orange c1: check label "Likes animals" return c2: check label "Like Monkees" return c3: check label "Like The Animals" ---State A check box is not much good if you can't get and set its state (on or off). across backtile polished orange c1: check label "Likes animals" return c2: check label "Like Monkees" return button "Set State" [ c1/data: true show c1 c2/data: false show c2 ] ===Sensor ---Purpose A sensor is an invisible user interface element. Using a sensor only makes sense in a few instances. If you want a keycode action where there is no visible user interface element to link the action to then a sensor can be used. This sensor code adds an Escape or Back or Enter action that will close the window. sensor 1x1 keycode [#"^M" #" " #"^(back)" #"^(ESC)"] [unview] Or if you want to make portions of an image 'hot' instead of putting buttons on top of the image, then a sensor will achieve this. across backtile polished orange txt "Click on the upper left section of the gray image to invoke the sensor action" return animage: image 100x100 polished ; here the image is just the polished area at animage/offset sensor 50x50 [alert "You pushed over the sensor"] ===Displaying Script Values If the script has a standard format headings, including custom ones, these can be used in the application by picking them from the system/script/header. backtile polished across banner "About" return text font-size 16 rejoin ["Title: " form system/script/header/title] return text font-size 16 rejoin ["Originator: " form system/script/header/author] return text font-size 16 rejoin ["Modifier: " form system/script/header/modifier] return text font-size 16 rejoin ["Version: " form system/script/header/version] return text font-size 16 rejoin ["Updated: " form system/script/header/date] return button "OK" [unview] ===Toggle A toggle button represents boolean state - either on or off. The button stays down until toggled again. Colors and text can be paired for "on" and "off" state. toggle "Up" "Down" red blue To set the state via program control, use: across backtile polished return t1: toggle "Up" "Down" red blue return button polished 204.0.0 100 "Toggle State" [ t1/state: not t1/state show t1 ] ===Rotary Buttons Rotary buttons are a different sort of user interface device. They can cause some challenges because the state is what's showing so you have to blindly "toggle" to get to a state that you want. But for quick and easy uses where the user is familiar with the options, they can be handy. If you plan to use them for a long list of items such as shown below, they might give you some usability concerns. ---Example across backtile polished rotary data ["First" "Second" "Third"] ---Setting State across backtile polished return r1: rotary data (my-options: ["First" "Second" "Third"]) return button 200 "Change Rotary State" [ r1/data: next r1/data if tail? r1/data [r1/data: head r1/data] show r1 ] ---Example - Usability For Unfamiliar List Contents The rotary button demonstrated here contains some information unfamiliar to most (Saturn's satellites). Use it to to set the state so that "Calypso" is set. Doable but without knowing the order each re-paint has to be checked to ensure that it is not "Calypso" before clicking again. If you do click past the choice that you want, there is no back function so you have to cycle through again. return rotary data [ "Pan" "Atlas" "Prometheus" "Pandora" "Epimetheus" "Janus" "Mimas" "Enceladus" "Tethys" "Telesto" "Calypso" "Dione" "Helene" "Rhea" "Titan" "Hyperion" "Iapetus" "Phoebe" ] ===Arrows REBOL/View supports arrows as simple user interface elements. Actions can be associated with them. ---Arrowheads And Actions By default, the arrow is 20x20 across size 200x100 backtile polished at 50x50 arrow left [alert "You pressed the left arrow"] [alert "You pushed the alternate button on the left arrow"] at 70x30 arrow up at 90x50 arrow right [alert "You pressed the right arrow"] at 70x70 arrow down ---Very Sharp Arrows And with a little work the arrows and boxes can be merged to look sharper. Here is a "sharp at both ends" arrow from the block diagram script by Carl: origin 0 backcolor white at 0x0 box 40x40 white effect [arrow rotate 270] at 110x0 box 40x40 white effect [arrow rotate 90] at 24x10 box black 100x20 ---Arrow Blend So that shows you how to make an arrow blend into your background size 100x100 across backdrop gray at 50x50 box 40x40 gray effect [arrow rotate 90] at 40x67 box 25x5 black ===LED LEDs would be used to display state (on or off). Clicking the LED toggles its state and changes its color. LEDs do not support alternate mouse button actions. across banner "Light Emitting Diode" return l1: led 10x10 [alert "LED left mouse action"] label "Alert status" l2: led 10x10 [alert "LED left mouse action"] label "Network status" return button "Change state" [ l1/data: not l1/data l2/data: not l2/data show [l1 l2] ] ===Box ---Boxing Draw boxes of any heigth and width with the box style box "Large Box" 200x400 polished orange ---Boxes As Lines If you make the box narrow enough or short enough it is a line (or a dot). across size 300x300 backtile polished at 50x0 box 3x100 gold at 0x50 b1: box 100x3 gold at 10x10 box 5x5 red ---Boxes Can Grow across size 300x300 backtile polished at 150x0 b1: box 100x3 gold return pad 0x100 button "Grow Down" [ for i 3 300 1 [ b1/size/y: 1 + b1/size/y wait 00:00:00.01 show b1 ] ] return pad 0x100 button "Back Up" [ for i 300 3 -1 [ b1/size/y: b1/size/y - 1 wait 00:00:00.01 show b1 ] ] You might even find a use for it. ---Grid Effect Not sure of the use for this yet but here is what you can do: return box "Grid Lock" with [effect: [grid 20x20 8x8 4x3]] white 300x200 return box "Grid Lock" with [effect: [grid 20x20 5x5 3x3]] white - 80 300x200 ===Frame Earlier versions of REBOL VID supported frames in layouts such as view layout [frame "This is the Bay" %bay.jpg] These are no longer valid. But frames can be put around some user interface devices: image 100x100 polished frame red ===List A list is an iterated sub layout and takes a layout block that uses the Visual Interface Dialect. The styles in the layout will be repeated until there is no more room to fit them within the list dimensions. ---Why A face can be iterated to create a number of virtual faces. For instance, when displaying a list of ten buttons, each of the buttons does not need to be created as a separate object. If the buttons only differ by a few facets (such as position, text, and action taken on selection), a model face can be created and iterated for its other position. This is useful when creating scrolling lists of files and other data sets that share the same appearance. ---Supply Supply provides the data to the list for an iterated face. do [cnt: 0 list-collection: [aqua sky water] ] backtile polished orange across list-displayed: list 100x72 [ origin 0 space 0x0 across color-field: txt bold 80x24 ] supply [ if none? one-color: pick list-collection count [exit] face/text: do pick [one-color] index ] return txt gold 180 "OK ... but not too useful" ---Supply Columns Maybe adding some more columns would be better. Here I'll add a column of buttons that display the color name and a column of text strings in italic. do [ cnt: 0 list-collection: [aqua sky water gold silver coffee] ] backtile polished orange across list-displayed: list 300x200 [ origin 0 space 0x0 across color-field: txt bold 80x24 color-button: button 80x24 pad 5x1 txt 100 italic ] supply [ if none? one-color: pick list-collection count [exit] face/text: do pick [ [one-color] [to-string one-color] [rejoin [" " to-string one-color]] ] index ] return txt gold 300 {A bit more interesting but the last row repeats to fill the list size. Some of the other VID components will automatically stretch to fit the size needed (such as this txt field) but the list does not behave that way. You have to make the list size fit its data or make it smaller and add a vertical scroll capability. That is shown a little later on.} ===List With Supplied Data This example is to show adding action to the list and adds a horizontal line between the rows. do [ cnt: 0 list-collection: [aqua sky water gold silver coffee] ] backtile polished orange across list-displayed: list water edge [size: 6x6 color: silver] 350x96 [ origin 0 space 0x0 across color-field: txt 60 [alert rejoin ["You pressed the " face/text " text field"]] pad 45x0 color-button: button 80 [alert rejoin ["You pressed the " face/text " button"]] pad 5x0 txt 120 italic return box 350x1 white ; this causes a horizontal line to appear between each row ] supply [ if none? one-color: pick list-collection count [exit] face/text: do pick [ [one-color] [to-string one-color] [rejoin [" " to-string one-color]] ] index ] ===Supply List With Scroll This example shows a supplied list with a scroll capability. More colors are added to demonstrate scrolling. Note that this is a verbose list of code where I added comments for my understanding of how the scroll was linked to the list. The same effect can be accomplished with fewer lines of code. do [ ; first this do block creates the data definitions needed. slider-position-clicked: 0 count: 0 x: 450 y: 300 row-y: 16 ; the row height includes the data plus any separator lines list-size: to-pair reduce [x y] ; this is the size of the display list separator-size: to-pair reduce [x 1] slider-size: to-pair reduce [24 y ] list-collection: [ aqua bar-color base-color beige black blue brick brown button-color coal coffee crimson cyan forest gold gray green ivory khaki leaf linen magenta main-color maroon mint navy oldrab olive orange over-color papaya pewter pink purple rebolor red sienna silver sky snow tan teal violet water wheat white yellow ] supply-style: stylize [ button-fixed: button left coal to-pair reduce [80 row-y] ; these keep the row elements the same height text-fixed: txt to-pair reduce [160 row-y] ] data-size: length? list-collection ] backtile polished orange ; this section layouts out the list across list-position: at ; the position is captured here in order to later put the slider beside it list-displayed: list linen edge [size: 6x6 color: tan] list-size [ origin 0 space 0x0 across styles supply-style text-fixed [alert rejoin ["You pressed the " face/text " text field"]] button-fixed [alert rejoin ["You pressed the " face/text " button"]] pad 5x0 text-fixed 80 italic [alert rejoin ["You pressed the italic " face/text " text field"]] return box separator-size gray ; this causes a horizontal line to appear between each row ] supply [ count: count + slider-position-clicked if none? one-color: pick list-collection count [exit] face/text: either count > (1 + data-size) [""] [ do pick [ [one-color] ; this is supplied to the first txt field (text-fixed) [to-string one-color] ; this is supplied to the button (button-fixed) [rejoin [" " to-string one-color " "]] ; this value is supplied to the last text-fixed field ] index ] ] ; now add a slider to the side of the list at list-position + (list-size * 1x0) ; this finds the top right border of the list widget vertical-slider: slider slider-size to-integer y / row-y [ slider-position-clicked: vertical-slider/data ; the slider has to be bound to the size of the list * ((1 + data-size) - ((y / (1 + row-y)))) ; including the row height if slider-position-clicked <> count [ count: slider-position-clicked show list-displayed ] ] ===Slider A slider is interactive user interface element. The data of a slider varies from 0 to 1. backtile polished orange across slider-1: slider 200x40 return button 200 "Move first slider to 50%" [ slider-1/data: .5 show slider-1 ] return txt 200 "The second slider in this example is initialized to the 80% mark." return slider 200x40 with [append init [data: .8]] ===Progress Indicator The progress-1 face in this example is a progress indicator. Because it is only displaying information, it is non-interactive i.e. you can not change its value by dragging its edges. The alternate button is not supported on a progress indicator. backtile polished orange across slider 200x40 [ progress-1/data: value field-1/text: join (to-integer (100 * value)) " %" show [progress-1 field-1] ] return progress-1: progress return field-1: field ===Panels Panels are used to create sub-panes that can be more easily managed by grouping the user interface devices on a panel. The first example below shows how to use panels for layout alignment. By creating a panel definition, all of the components defined within it are aligned relative to its origin. across backtile polished brick tabs 50 return panel-1: panel 250x120 [ backtile polished across return button water 200 "Button A" return button aqua 200 "Button B" return button sky 200 "Button C" ] at panel-1/offset + panel-1/size panel 60x90 [ ; start at the bottom right corner of panel-1 backtile polished across return button tan 20 "1" return button coffee 20 "2" ] ---Multiple SubPanels example This example from the REBOL html documentation shows how to easily hide and show sections of a user interface by displaying them on the face area of a box. do [ ; define two panels panel1: layout [ origin 8x8 h2 "Panel 1" field "Field 1" field "Field 2" button "The Answer" [alert "I know nothing."] ] panel2: layout [ origin 8x8 h2 "Panel 2" across txt "X:" slider 150x16 return txt "Y:" slider 150x16 return check [panel2/color: maroon show panel2] txt "Don't click this" return check [panel2/color: silver show panel2] txt "Click this" return ] panel1/offset: 0x0 panel2/offset: 0x0 ] vh2 "Subpanel Examples" ; now demonstrate panel use guide pad 20 button "Panel 1" [panels/pane: panel1 show panels] button "Panel 2" [panels/pane: panel2 show panels] button "Quit" [unview] return box 2x140 maroon return panels: box 220x140 do [panels/pane: panel1] ===Simple Default Style Override The style's default look can be overriden easily with one line of code. For example, to make the default button size 200x200 with a water color, use style button button 200x200 water button "Big Blue Button" [unview] To make the toggle some different default colors: style toggle toggle crimson sky toggle "Up" "Down" Note that these stay in effect until they are overridden so if you use the default values, exercise some care unless you meant to do that. ===Image Maker An option used by Carl in some of his programs is to let View create specific icons so that you have portability and more control of look of the image then if you referenced an external file such as gif that was a bullet display. Here's how to do that: do [ make-image: func [xy wh eff] [ eff: layout [ size 20x20 at xy box wh effect eff ] eff/color: rebolor to-image eff ] dot: make-image 6x5 9x9 [gradient 1x1 255.0.0 0.0.0 oval key 0.0.0] dot-big: make-image 8x7 12x12 [gradient 1x1 255.0.0 0.0.0 oval key 0.0.0] arr: make-image 3x3 14x14 [arrow 0.0.127 rotate 90] ard: make-image 3x3 14x14 [arrow 0.0.127 rotate 180] ] ; end of "do" - it is needed here because easyvid approach is expecting vid dialect commands banner "Presentation Points" size 400x300 across style label label gold ; make a label's text be a different color than the default return image dot label "This is bullet point number 1" return image dot label "This is bullet point number 2" return image arr label "This is arrow point number 1" return image ard label "This is an arrow making a different point" return image dot-big pad 0x4 area 300x80 wrap "And because these arrows and dots are images, action can be added to them to make them 'hot' with mouse actions including 'over'." ===Needs Some Work !More to come. These still need to be covered in this tutorial: text-list data [ icon ] ===Digital Clock origin 0 banner "00:00:00" rate 1 effect [gradient 0x1 0.0.150 0.0.50] feel [engage: func [face act evt] [face/text: now/time show face]] ===REBOL Logo image %rebo-logo.gif [unview] ===Paint Drops REBOL one liner by Vincent Ecuyer b: box rate 9 effect[draw[pen(random snow)circle(random 99x99)2]blur]box 1x1 rate 9 effect[draw[(b/image: to-image b)]] ===eMailer One line emailer by Doc Kimbel Assumes you have set up your email in set-user e: field "Email" s: field "Subject" m: area "Body" btn "Send"[send/subject to-email e/text m/text s/text alert "ok"] ===Hello World text "Hello World!" button "Close" [unview] ===Three Buttons button "Yes" button "Maybe" button "No" ===View Web Text text 800x600 read http://www.rebol.com ===View Image image %palms.jpg ===View Image and File Name Here a do block is used to initialize the file variable within the layout code. do [file: %palms.jpg] image file text form file ===View Image behind File Name Here a do block is used to initialize the file variable within the layout code. do [file: %palms.jpg] image file form file ===Buttons From Images backdrop 40.70.140 stat: text bold "Click a Button" 100x20 240.140.40 center button "Bay Test" %bay.jpg 100x100 [ stat/text: "Upper" show stat ] button "Blue Test" %bay.jpg 100x100 10.30.180 [ stat/text: "Lower" show stat ] ===View List list blue 320x200 [across text white 200 text white 100] data [ ["John" 100] ["Joe" 200] ["Martin" 300] ] ===Movie Credits backdrop %bay.jpg effect [fit] text center bold 240x30 "REBOL, The Movie" yellow font [size: 16] credits: text { Edit This File To Add Your Own Credits It is very simple to do. Only takes a minute. Only REBOL Makes It Possible... } white bold center 240x180 rate 30 para [origin: 0x+100] feel [engage: func [f a e] [ if a = 'time [f/para/origin: f/para/origin - 0x1 show f] ] ] ===Fire Demo box 150x150 with [ edge: none img: image: make image! 150x150 rate: 20 text: "FIREBOLEK" font: make font [size: 24 color: 255.125.0] basic: [draw [image make pair! reduce [(random 3) - 2 -1] img]] effects: reduce [ append copy basic [blur luma -10] append copy basic [sharpen luma -10 blur] append copy basic [contrast 10 blur luma -5] ] effect: first effects feel: make feel [ engage: func [f a e][ switch a [ down [f/effects: next f/effects if tail? f/effects [f/effects: head f/effects] f/effect: first f/effects show f] time [show f repeat i f/size/x - 4 [poke f/image (f/size/x * f/size/y) - i - 2 (random 255.0.0 + random 0.127.0) * 3] f/img: to-image f] ] ] ] ] text 150 {classical fire demo for REBOL^/ press on fire to see other effects.^/ Written by ReBolek, 2001 in 15 mins.^/ We need new category on Assembly:^/ less-than-kb-demo ;-)} with [font: make font [size: 9]] ===Bezier Oldes Bezier Line Demo See script library for %bezier-curve.r Uses functions and data initialized at script startup The end points are draggable to change the curve!!!! Here a do block is used to allow executable lines for initialization purposes. do [ draw-beziere-curve: has [result pp x0 x1 x2 x3 y0 y1 y2 y3 cx bx ax cy by ay t tx ty s] [ result: make block! 120 pp: p0/size/x / 2 x0: p0/offset/x + pp y0: p0/offset/y + pp x1: p1/offset/x + pp y1: p1/offset/y + pp x2: p2/offset/x + pp y2: p2/offset/y + pp x3: p3/offset/x + pp y3: p3/offset/y + pp insert result compose [ pen 155.0.0 line (p0/offset + pp) (p1/offset + pp) line (p2/offset + pp) (p3/offset + pp) pen 255.255.255 line (p0/offset + pp) ] cx: 3 * (x1 - x0) bx: 3 * (x2 - x1) - cx ax: x3 - x0 - cx - bx cy: 3 * (y1 - y0) by: 3 * (y2 - y1) - cy ay: y3 - y0 - cy - by t: s: 0.01 ;this value sets quality of the curve while [t <= 1][ tx: to integer! ( (ax * (t * t * t)) + (bx * (t * t)) + (cx * t) + .5 ) + x0 ty: to integer! ( (ay * (t * t * t)) + (by * (t * t)) + (cy * t) + .5 ) + y0 t: t + s insert tail result to pair! reduce [tx ty] ] return result ] click?: false mouse-pos: 0x0 ] origin 0 bkg: box black 400x400 with [effect: reduce ['draw make block! 120]] style point box 10x10 with [ effect: [draw [pen 0.255.0 fill-pen 0.200.0 circle 4x4 4]] changes: [offset] feel: make feel [ engage: func [f a e][ if a = 'down [click?: on mouse-pos: e/offset] if a = 'up [click?: off] if find [over away] a [ if click? [ f/offset: f/offset + e/offset - mouse-pos bkg/effect/2: draw-beziere-curve show [bkg f] ] ] ] ] ] at 300x200 p0: point at 200x100 p1: point at 200x300 p2: point at 100x200 p3: point do [bkg/effect/2: draw-beziere-curve] ===Buttons Galore Buttons galore from the library script %buttons.r Here a do block is used to execute the initialization needed within the layout block. do [ group: ["rotary" "test" "button"] ] origin 20x10 backdrop effect [gradient 0x1 100.20.0] vh1 "52 Button Click-up - Each with a different click effect..." vtext bold "Here is a small sampling of the thousands of button effects you can create. (This is 78 lines of code.)" at 20x80 guide button "simple" button form now/date button "colored" 100.0.0 button "text colored" font [colors: [255.80.80 80.200.80]] button with [texts: ["up text" "down text"]] button "bi-colored" colors [0.150.100 150.20.20] button with [texts: ["up color" "down color"] colors: [0.150.100 150.20.20]] button "image" pic button "color image" pic 200.100.50 button "flip color" pic with [effects: [[fit colorize 50.50.200][fit colorize 200.50.50]]] button "blink" with [rate: 2 colors: [160.40.40 40.160.40]] return button "multiply" pic with [effects: [[fit][fit multiply 128.80.60]]] button "brighten" pic with [effects: [[fit][fit luma 80]]] button "contrast" pic with [effects: [[fit][fit contrast 80]]] button "horiz flip" pic with [effects: [[fit][fit flip 1x0]]] button "vert reflect" pic with [effects: [[fit][fit reflect 0x1]]] button "invert" pic with [effects: [[fit][fit invert]]] button "vert grad" with [effects: [[gradient 0x1 0.0.0 0.200.0] [gradient 0x1 0.200.0 0.0.0]]] button "horiz grad" with [effects: [[gradient 1x0 200.0.0 200.200.200][gradient 1x0 200.200.200 200.0.0]]] button "both grad" with [effects: [[gradient 1x0 140.0.0 40.40.200] [gradient 0x1 40.40.200 140.0.0]]] button "blink grad" with [rate: 4 effects: [[gradient 1x0 0.0.0 0.0.200] [gradient 1x0 0.0.200 0.0.0]]] button "blink flip" pic with [rate: 8 effects: [[fit][fit flip 0x1]]] return button "big dull button with several lines" 100x80 0.0.100 button "dual color" pic 50.50.100 100.50.50 100x80 with [edge: [color: 80.80.80]] button "big edge" pic 100x80 with [edge: [size: 5x5 color: 80.80.80] effects: [[fit colorize 50.100.50][fit]]] button "oval reflect" pic 50.100.50 100x80 with [effect: [fit reflect 1x0 oval]] return button "text on top" pic 100x80 with [font: [valign: 'top] effects: [[fit gradcol 1x1 200.0.0 0.0.200] [fit gradcol -1x-1 200.0.0 0.0.200]]] button "text on bottom" pic 100x80 50.50.100 with [font: [valign: 'bottom] effects: [[fit][fit invert]]] button "big text font" pic 100x80 with [font: [size: 24] effects: [[fit multiply 50.100.200][fit]]] button "cross flip" pic 50.100.50 100x80 with [effect: [fit flip 0x1 reflect 0x1 cross]] return toggle "toggle" toggle "toggle red" 100.0.0 toggle "toggle up" "toggle down" toggle "toggle colored" 0.150.100 150.20.20 toggle "up color" "down color" 0.150.100 150.20.20 toggle "toggle multiply" pic with [effects: [[fit][fit multiply 128.80.60]]] toggle "toggle contrast" pic with [effects: [[fit][fit contrast 80]]] toggle "toggle cross" pic with [effects: [[fit][fit cross]]] toggle "toggle v-grad" with [effects: [[gradient 0x1 0.0.0 0.200.0] [gradient 0x1 0.200.0 0.0.0]]] toggle "toggle h-grad" with [effects: [[gradient 1x0 200.0.0 200.200.200][gradient 1x0 200.200.200 200.0.0]]] toggle "toggle both" with [effects: [[gradient 1x0 140.0.0 40.40.200] [gradient 0x1 40.40.200 140.0.0]]] return rotary data group rotary data reduce [now/date now/time] rotary data group 100.0.0 0.100.0 0.0.100 rotary data group with [font: [colors: [255.80.80 80.200.80]]] rotary data group with [colors: [0.150.100 150.20.20]] rotary data group pic rotary data group pic 200.100.50 rotary data group pic with [effects: [[fit colorize 50.50.200][fit colorize 200.50.50]]] rotary data group with [effects: [[gradient 0x1 0.0.0 0.200.0] [gradient 0x1 0.200.0 0.0.0]]] rotary data group with [effects: [[gradient 1x0 200.0.0 200.200.200][gradient 1x0 200.200.200 200.0.0]]] rotary data group with [effects: [[gradient 1x0 140.0.0 40.40.200] [gradient 0x1 40.40.200 140.0.0]]] ===Paint Program This section is a clip of the layout portion of Frank Sievertsen's remarkable paint program. Open this example to enable a quick link to the real source: button "Browse Source" [browse http://www.reboltech.com/library/html/paint.html] button "Close" [unview] In the example below, a DO block is used to execute initialize code. do [ color: fill-color: start: draw-image: draw-pos: tmp: none type: 'box undos: [] redos: [] draw: func [offset /local tmp] [ compose [ pen (color/color) fill-pen (fill-color/color) (type) (start) (either type = 'circle [ tmp: offset - start to-integer square-root add tmp/x ** 2 tmp/y ** 2 ] [offset]) ] ] ] backdrop effect compose [gradient 1x1 (sky) (water)] across draw-image: image white 300x300 effect [draw []] feel [engage: func [face action event] [ if all [type start] [ if find [over away] action [ append clear draw-pos draw event/offset show face ] if action = 'up [ append/only undos draw-pos draw-pos: tail draw-pos start: none ] ] if all [type action = 'down] [ start: event/offset ] ]] do [draw-pos: draw-image/effect/draw] guide style text text [ tmp: first back find face/parent-face/pane face tmp/feel/engage tmp 'down none tmp/feel/engage tmp 'up none ] label "Tool:" return radio [type: 'line] text "Line" return radio [type: 'box] on text "Box" return radio [type: 'circle] text "Circle" return style color-box box 15x15 [ face/color: either face/color [request-color/color face/color] [request-color] ] ibevel color: color-box 0.0.0 text "Pen" return fill-color: color-box text "Fill-pen" return button "Undo" [if not empty? undos [ append/only redos copy last undos draw-pos: clear last undos remove back tail undos show draw-image ]] return button "Redo" [if not empty? redos [ append/only undos draw-pos draw-pos: insert draw-pos last redos remove back tail redos show draw-image ]] ===Font Lab Carl's Font lab Here a do block is used to initialize some values needed in the layout do [ change-styles: func [style start facet subfacet value /local v][ start: find style/pane start foreach f start [ f: in f facet if subfacet <> 'none [f: in get f subfacet] either block? value [ if not block? get f [set f either none? get f [copy []][reduce [get f]]] either v: find get f value [remove v][head insert get f value] ][set f value] ] show style ] chg: func ['facet 'subfacet value] [ change-styles external-view norm-start facet subfacet value ] shad: does [chg font shadow sdir * to-integer sl2/data * 16] sdir: 1x1 sz: 180x40 sx2: sz/x / 2 ] style tgl toggle 60 style lab vtext bold backcolor rebolor space 0x5 across p: choice 180 "Sans-Serif Style" "Serif Style" "Fixed Width Style" [chg font name pick reduce [font-sans-serif font-serif font-fixed] index? p/data] return tgl "Bold" [chg font style [bold]] tgl "Italic" italic [chg font style [italic]] tgl "Lined" underline [chg font style [underline]] return tgl "Left" of 'tg1 [chg font align 'left] tgl "Center" of 'tg1 [chg font align 'center] tgl "Right" of 'tg1 [chg font align 'right] return tgl "Top" of 'tg2 [chg font valign 'top] tgl "Middle" of 'tg2 [chg font valign 'middle] tgl "Bottom" of 'tg2 [chg font valign 'bottom] return lab "Size:" 60x20 font [] sl: slider 120x20 [chg font size max 8 to-integer sl/data * 40] with [append init [data: .5]] return lab "Space:" 60x20 font [] sl1: slider 120x20 [chg font space (1x0 * to-integer sl1/data * 20) - 5x0] return lab "Shadow:" 60x20 font [] sl2: slider 120x20 [shad] with [append init [data: .5]] return lab "Shad Dir:" 60x20 arrow left [sdir: sdir * 0x1 + -1x0 shad] pad 6 arrow right [sdir: sdir * 0x1 + 1x0 shad] pad 6 arrow up [sdir: sdir * 1x0 + 0x-1 shad] pad 6 arrow down [sdir: sdir * 1x0 + 0x1 shad] pad 6 return button sx2 "Text Color" [chg font color request-color] button sx2 "Area Color" [chg color none request-color] return button sx2 "Help" [alert "Click the controls on the left to change text on the right."] button sx2 "Close" #"^Q" [unview] below at p/offset + (p/size * 1x0) + 10x0 norm-start: Title "Title" sz h1 "Heading 1" sz h2 "Heading 2" sz h3 "Heading 3" sz h4 "Heading 4" sz h5 "Heading 5" sz at norm-start/offset + (norm-start/size * 1x0) + 10x0 banner "Banner" sz vh1 "Video Heading 1" sz vh2 "Video Heading 2" sz vh3 "Video Heading 3" sz vtext "Video Text" sz text "Document Text" sz ===Windows Clipboard ---Cut or Copy to Clipboard Normal Windows cut and copy commands are supported e.g. on a field, contents can be copied to the clipboard. Programmatic access is also supported for text contents. across label "Entry field: " return input-field: field 200 "Enter your text here" return button 200 "Copy Entry field data to clipboard" [write clipboard:// input-field/text] return button 200 "Show Clipboard Contents" [alert read clipboard://] ---Clearing The Clipboard across button 200 "Clear The Clipboard" [write clipboard:// ""] return button 200 "Show Clipboard Contents" [alert read clipboard://] ---Paste from Clipboard Normal Windows paste commands are supported e.g. on a field, contents can be pasted. Programmatic access is also supported for text contents. across button 200 "Show Clipboard Contents" [alert read clipboard://] ===Requesters REBOL View supports an assortment of requesters. The results of the request-* code are returned as its value e.g. chosen-date: request-date ---Request Yes | No | Cancel Provides the user the capability to pick from choices "Yes" | "No" | "Cancel" The result is "True" | "False" | none do [user-response: none] button "Simple Request" 200 [user-response: request "Do you want to abandon your input so far?"] button "View User Response" 200 [alert form user-response] ---Pick A Color do [chosen-color: gold] button "Pick Color" 200 [chosen-color: request-color] button "View Chosen Color" 200 [alert form chosen-color] ---Pick An Answer The request allows a descriptive value then 1, 2, or 3 options. button "Format" 100 [request ["Your message goes here. It will wrap if it is very very long." "Choice 1" "Choice 2" "Choice 3"]] button "Example 1" 100 [request ["Pick The Color of Your New Model T" "Black"]] button "Example 2" 100 [request ["Pick one country" "England" "France"]] button "Example 3" 100 [request ["Run Extract Script?" "Yes" "No" "Cancel"]] ---Pick A Date do [chosen-date: 01-Jun-1990] button "Pick Date" 200 [chosen-date: request-date] button "See Chosen Date" 200 [alert form chosen-date] ---Get A LogonID and Password do [credentials: none] button "Get Credentials" 200 [credentials: request-pass] button "View Credentials" 200 [ view/new layout [ size 200x200 backtile polished orange across banner "Credentials" return label "LogonID: " txt pick credentials 1 return label "Password: " txt pick credentials 2 ] ] ---Pick A File Format: REQUEST-FILE /title title-line button-text /file name /filter filt /keep do [filter-block: ["*.gif" "*.jpg" "*.png" "*.bmp"]] button "Pick Any File" 300 [request-file "Select"] button "Pick With A Title" 300 [request-file/title "Pick The Data File to Process" "OK"] button "Change the Action Button Name" 300 [request-file/title "Pick The Data File to Process" "OK"] button "Keep Results" 300 [request-file/title/keep "Previous Select On This Button Is Kept" "OK"] button "Filter Files" 300 [request-file/title/filter "Pick An Image File" "OK" filter-block] ---Request Text Input Format: REQUEST-TEXT /offset xy /title title-text /default str button "Request Text Input - all default parameters" 300 [request-text] button "Request Text Input - with offset to window" 300 [request-text/offset 40x40] button "Request Text Input - with title" 300 [request-text/title "Input your question"] button "Request Text Input - with default" 300 [request-text/default "Key your question here"] button "Request Text Input - with all parameters" 300 [request-text/offset/title/default 100x100 "Input your question" "Key your question here"] ---Request Download from Net Request a file download from the net. Show progress. Return none on error. Format: REQUEST-DOWNLOAD url /to local-file backtile polished orange button "Request File Download To local REBOL Cache" 300 [request-download http://www.rebol.com/index.html] button "Request File Download To This Directory" 300 [request-download/to http://www.rebol.com/index.htmlnone] button "Request File Download To Specific File" 300 [request-download/to http://www.rebol.com/index.html%/c/temp.html] ===Message Box button "Format" 100 [request ["Your message goes here. It will wrap if it is very very long and tedious." "Close"]] button "Example" 100 [request ["You done good!" "OK"]] ---Confirmation button "Exit" 100 [ request/confirm "Do you want to quit without saving?" [] ] ===Calling the Editor The REBOL editor is now callable with the editor function backtile polished button 300 "Create a test file and edit it" [ write %temp.txt "This is a test file" editor %temp.txt ] frame 204.0.0 ===Calling Windows With View/Pro the calling of executables is supported. Here are two simple examples that will work if you have View/Pro on a platform where a notepad and calc are avaiable. across backtile size 200x200 return button "Notepad" [call ["notepad.exe"]] return button "Calculator" [call ["calc.exe"]] ===Window Options Note that these are options which are ignored by the easyvid.r code that displays them in this tutorial. Copy the code out and run it standalone in REBOL/View. ---Block Options: No Border and No Title view/options layout [ size 200x200 banner "Window Options" button "Close" [unview] ] [ no-border no-title ] ---Word Option: No Title Note that the results of this are surprising if you run it from within a script that has a title option. It is displayed near location 0x0 of the resulting window instead of in the window frame that has been suppressed. view/options layout [ size 200x200 banner "Window Options" button "Close" [unview] ] 'no-title ===REBOL/View Notifiers REBOL/View supports simple notifiers to send messages to a user interface ---Alert button 220 polished "Send alert message" [ alert "This causes a dialogue box to popup" ] ---Flash Flash is provided to provide a message and keep on processing. across size 200x200 return button 150 "Create Flash Message" [flash "Testing"] return button 150 "Unview Flash" [unview] ---Inform inform layout [ backtile polished sky across text font-size 16 bold underline red "Action complete!" return button "OK" [unview]] ---Popup REBOL supports popups (see note below before running!) across size 200x200 button "Show Popup" [ show-popup popup-layout: layout [ across size 200x200 backtile polished banner "The Popup Worked" return button "Unview" [unview] ] ] return button "Hide Popup" [unview/only popup-layout] I have had some difficulties (process lockup) when using these popups so just use view layout [...] and skip the popup part. ===Diagram Example Carl has created some diagrams in REBOL using styles to make an architecture diagram. This is a slightly modified version. Here again a DO block precedes the layout code for non-layout initiatiation ... here the definition of a function. Why make a diagram this way? 1. One reason is that it can be interactive ... the sections are all "hot" with a few lines of code. Here they pop up REBOL Dialogs but they could do anything that can be coded even something as simple as launching a browser on a different URL for each diagram component. The "Compositor" box demonstrates this by launching your browser on the REBOL.com site. 2. Very small footprint size compared to other presentation source formats. do [ information: func [info [string!]][ request/ok reform [ info] ] ] style bx box 255.255.255 0.0.0 font-size 11 font [color: 0.0.0 shadow: 0x0] edge [size: 5x2] [request/ok reform ["No information on" face/text]] style bb box bold left top para [origin: 6x10] edge [size: 2x2] [request/ok reform ["No information on" face/text]] backcolor silver + 30 at 15x15 h1 486 left "Arch Structure" at 15x50 bb "Client" 506x436 160.80.80 [ information "Any client machine e.g. branch or Call Centre"] at 25x252 bb "Mid-Tier" 486x68 effect [gradient 1x1 169.91.155 80.45.75] at 25x152 bb "UI" 486x96 effect [gradient 1x1 38.156.82 19.78.41] at 25x324 bb "Servers" 486x151 effect [gradient 1x1 103.96.200 50.45.100] [ information "Mid-tiers servers with XYZ relational database server" ] at 130x216 bx "Compositor" 182x24 bold [browse http://www.rebol.com] at 130x60 bx "Browser" 120x24 [information "Branch standard browser"] at 130x188 bx "Sound" 182x24 bold [information "Sound services"] at 255x60 bx "Win32" 120x24 [information "Win32 App"] ===Column Images Creates a layout looking (a little) like columns. It uses a gradient effect going from darker to lighter do [ column: make image! layout [ backdrop effect [gradient 1x0 20.20.20 250.240.230 luma 60] ] column-size: 50x420 area-size: 400x420 ; height should be the same as column-size ] backtile polished tan across image column-size column pad -10x0 ; this brings the default VID spacing back area wrap area-size edge none ; take the edge off of area so that it more closely blends shadow 2x2 pad -10x0 image column-size column ; if you want a right column ===Tree View of Directory This is Didier's tree view %request-dir.r In this sample, you must be online because the code is accessed on the Rebol script server do [do http://www.rebol.org/library/scripts/request-dir.r request-dir ] Note that: * the script is read from the script library but runs locally * it is showing the files in your directories ===The emailer Function The function for emailing has appeared in Jan-2004 on the rebol list. It is a simple idea ... to create a standard emailer by invoking a function emailer. This window will show the source: text wrap 400x300 mold get 'emailer And it is simple to run: across size 200x200 return button 150 "Run emailer" [emailer] But on my machine there is again a problem - the emailer locks up REBOL/View. Recommendation: * if it works use it if you like * use Doc Kimbel's one liner (works for me). Assumes you have set up your email in set-user e: field "Email" s: field "Subject" m: area "Body" btn "Send"[send/subject to-email e/text m/text s/text alert "ok"] * better yet, make your own... if the code for the basic is 1 line, then a custom version is not far away. Here's an example that allows selection of your frequent contacts (entered in the names-addresses series) and keeps a journal of email that you have sent (using this code) in file email-journal.txt. Assumes you have setup your user profile correctly to allow sending of email. do [ names-addresses: [ "Contact 1" [contact1-:-no-such-address-:-com] "Contact 2" [contact2-:-no-such-address-:-com] "Contact 3" [contact3-:-no-such-address-:-com] ] names: copy [] foreach [name address] names-addresses [append names name] journal?: false ; set to true if want to journalize sent email ] e: rotary 200 data sort names s: field "Subject" m: area 500x400 wrap "Body" btn "Send"[ send/subject who-to: select names-addresses e/text m/text s/text alert join "Sent email to: " form who-to if journal? [ write/append %email-journal.txt rejoin [ "[ When-sent: " now/precise " To: " who-to " Subject: {" s/text "} Message: {" m/text "} ] " newline ] ] ] btn "Quit" [unview] It won't take much to change this from the rotary used to a text list allowing multiple selections. ===Some More email Earlier there have been a few examples of sending email. Here are a few more that often appear in the mailing list ---Simple Send This is not a runnable version because you don't need anything but REBOL/Core to run it. It has been wrapped in a DO block so it does not send errors to the console. ---Quick Send Short Message do [ send [address-:-isp-:-com] "My Message" ] ---Send Longer Message Now a more complex message where there is a body to the message: do [ send [address-:-isp-:-com] {Sample Message This is the body of the message } ] ---Send with One Attachment Here, so that the sample does not fail, test file(s) are created by the code before attempting the send. do [ test-file: %file-attachment.txt write test-file {Just some test data to create a file} send/attach [address-:-isp-:-com] {Sample Message This is the body of the message } test-file ] ---Send with Attachments And a message with multiple attachments. Here, so that the sample does not fail, test file(s) are created by the code before attempting the send. do [ files: [%file-attachment.txt %second-attachment.txt] foreach file files [write file {Just some test data to create a file}] send/attach [address-:-isp-:-com] {Sample Message This is the body of the message } files ] ---Send to Multiple Addresses Here, so that the sample does not fail, test file(s) are created by the code before attempting the send. do [ files: [%file-attachment.txt %second-attachment.txt] foreach file files [write file {Just some test data to create a file}] send/attach [[address-:-isp-:-com][asecondAddress-:-isp-:-com]] {Sample Message This is the body of the message } files ] ---Send/only Same send only just provide the SMTP server with one copy: Here, so that the sample does not fail, test file(s) are created by the code before attempting the send. do [ files: [%file-attachment.txt %second-attachment.txt] foreach file files [write file {Just some test data to create a file}] send/only/attach [[address-:-isp-:-com][asecondAddress-:-isp-:-com]] {Sample Message This is the body of the message } files ] ---Send With Header This example uses a Do block to wrap the code. If you execute the email should be sent. But it is unlikely to be delivered. The addresses for me and you should be changed in your use as well as the * Subject * Organization * Content do [ me: [myaddress-:-isp-:-com] you: [youraddress-:-isp-:-com] header-object: make system/standard/email [ From: me Reply-To: me Subject: "Some Stuff" Organization: "Cyberia" MIME-Version: 1.0 Content-Type: "text/plain" ] send/header you {Test Message This is the message body. } header-object ] ---Send with CC This adds a copy value in the header-object do [ me: [myaddress-:-isp-:-com] you: [youraddress-:-isp-:-com] header-object: make system/standard/email [ From: me Reply-To: me Subject: "Some Stuff" Organization: "Cyberia" MIME-Version: 1.0 Content-Type: "text/plain" cc: [another-address-:-isp-:-com] ] send/header you {Test Message This is the message body. } header-object ] ---Doctored Code Again Doc Kimbel's one liner that does not waste a character e: field "Email" s: field "Subject" m: area "Body" btn "Send"[send/subject to-email e/text m/text s/text alert "ok"] ===Sharp Styles I really like the style that Didier has put around his email previewer do [ ss-light: stylize [ text: text feel none vtext: vtext feel none col-hdg: text black 255.255.204 bold middle effect [] col-txt: text edge [size: 1x0 color: gray effect: 'bevel] ban: vh3 left to-pair reduce [ 50 logo.gif/size/y] edge [ color: 0.0.0 size: 0x1] feel none with [color: black] lab: label para [origin: 2x3 margin: 0x2] labe: lab edge [size: 1x1 color: water effect: 'ibevel] inf: info 100 font-color yellow bkg: backdrop water - 10.10.10 txt-big: vtext 300 font-size 18 font-color yellow center rti: vtext font-size 14 bold txt-ch: rti font-color white 170x22 para [ origin: 2x3] with [font: make font [ color: white] colors: [55.95.155 235.170.55]] btnb: btn 70.70.70 font-color white men: rti 264 edge [size: 1x1 color: water effect: 'bevel] para [origin: 20x2 margin: 1x4] with [color: water - 40.40.40 effect: first effects: [ [draw [pen white fill-pen white polygon 5x2 13x10 5x18]] [draw [pen white fill-pen white polygon 2x5 10x13 18x5]] ] feel: none] ;system/view/vid/vid-feel/hot] cbox: box 60x20 edge [size: 1x1 color: water effect: 'bevel] [ if temp: request-color/color first face/data [face/color: temp change face/data temp show face] ] with [append init [color: first data]] ] stylesheet: ss-heavy: stylize/styles [ col-hdg: col-hdg effect [gradcol 0x1 200.200.160 155.155.104] ban: ban effect [merge gradcol 150.180.200 0.0.0] with [color: none] bkg: backdrop effect [gradient 1x1 65.125.175 45.75.115 grid 2000x4 1999x4 70.130.190 blur] txt-big: vtext 300 font-size 18 font-color yellow center rti: vtext font-size 14 bold txt-ch: txt-ch effect [gradcol -1x1 105.105.105 151.151.151] men: men effect [gradcol -1x0 black water] ] ss-light ] styles stylesheet space 4x4 origin 4x4 across bkg pad 15 ban 235 :title para [origin: 32x0] pad -254 image 30x30 %palms.jpg effect [fit key 255.0.255] } code: text: layo: external-view: none sections: [] layouts: [] space: charset " ^-" chars: complement charset " ^-^/" rules: [title some parts] title: [text-line (title-line: text)] parts: [ newline | "===" section | "---" subsect | "!" note | example | paragraph ] text-line: [copy text to newline newline] indented: [some space thru newline] paragraph: [copy para some [chars thru newline] (emit txt para)] note: [copy para some [chars thru newline] (emit-note para)] example: [ copy code some [indented | some newline indented] (emit-code code) ] section: [ text-line ( append sections text append/only layouts layo: copy page-template emit h1 text ) newline ] subsect: [text-line (emit h2 text)] emit: func ['style data] [repend layo [style data]] emit-code: func [code] [ remove back tail code repend layo ['code 460x-1 trim/auto code 'show-example] ] emit-note: func [code] [ remove back tail code repend layo ['tnt 460x-1 code] ] show-example: [ if external-view [xy: external-view/offset unview/only external-view] xcode: load/all face/text if not block? xcode [xcode: reduce [xcode]] ;!!! fix load/all if here: select xcode 'layout [xcode: here] external-view: view/new/offset layout xcode xy ] page-template: [ size 500x480 origin 8x8 backdrop white - 80 style code tt snow navy bold as-is para [origin: margin: 12x8] style tnt txt maroon bold ] parse/all detab content rules show-page: func [i /local blk last-face][ i: max 1 min length? sections i append clear tl/picked pick sections i if blk: pick layouts this-page: i [ f-box/pane: layout/offset blk 0x0 last-face: last f-box/pane/pane ; bh slider f-box/pane/pane/1/size: f-box/pane/size: max 500x480 add 20x20 add last-face/offset last-face/size ; bh slider update-slider ; bh slider show f-box ] show tl ; changed to after slider update ; was not refreshing the index display ] update-slider: does [ sld/data: 0 either object? f-box/pane [ sld/redrag min 1.0 divide sld/size/2 f-box/pane/size/2 sld/action: func[face event] compose [ f-box/pane/offset/2: multiply face/data (subtract 480 f-box/pane/size/2) show f-box ] ][ sld/redrag 1.0 show sld sld/action: none ] show sld ] main: layout [ backtile polished across vh2 title-line return tl: text-list 160x480 bold black white data sections [ show-page index? find sections value ] h: at f-box: box 500x480 at h + 500x0 sld: slider 24x480 ; add brett's slider at h + 456x-24 across space 4 arrow left keycode [up left] [show-page this-page - 1] arrow right keycode [down right] [show-page this-page + 1] pad -150 txt white italic font-size 16 form system/script/header/date/date ] show-page 1 xy: main/offset + either system/view/screen-face/size/x > 900 [ main/size * 1x0 + 8x0][300x300] view main | |
btiffin: 2-Apr-2008 | REBOL is not so big on line numbers. Even when you look at http://www.rebol.net/cookbook/recipes/0042.html which is Carl's source parser, and added a line number tracker, it won't be accurate as a multiline comment (embedded newlines) counts as one source entity to LOAD. I think the best you could really hope for is an offset into the sources at the start of a entity. REBOL scripts do not require any newlines to function properly. But aain, an index? into the sources would work. Brian; Always take my squawking for what it is, someone that thinks he knows but knows he doesn't, yet still wants to help. :) | |
btiffin: 5-Apr-2008 | Working on locate.r; saving a database after a scan of the library scripts can't be reloaded autoextract.r has the following inside it: output: [{Self-extracting REBOL-compressed file REBOL [ Title: "Self-extracting compressed file" Date: } now { File: } mold infile { Author: "Autoextract function by Bohdan Lechnowsky" Comment: ^{ Simply run this script and it will decompress and save the file for you ^} ] if exists? } mold infile { [ print ["} infile { already exists, please rename" " existing file and run again."] halt ] write } mold infile { decompress 64#} mold file ] write outfile to-string reduce output How do I get REBOL to keep the ^{ and ^} across a save/all and load? locate.r keeps a reference to all block! info for the tour sequence. LOADing this (after a SAVE/ALL) causes an invalid string error. Any hints? | |
Henrik: 25-Apr-2008 | I see the issue, but I'm not sure it's unsolvable. It seems strange to me that you can't pass a script to DO as an argument, and then not have that filename stored somewhere. If multiple scripts are DO'ed or LAUNCH'ed under that script, then append them to a block until the script is finished and then remove it again, when that script is done. system/script/parent provides similar functionality, except, it does nothing to track the true filename, but only the header which may hold incorrect information. | |
[unknown: 5]: 23-Jun-2008 | I have reassociated my scripts in windows with the new 2.7.6 core but I now get an error whenever I attempt to open them which is: ** Access Error: Cannot open /C/Documents ** Near: do/args script system/script/args Any ideas? | |
Geomol: 16-Oct-2008 | I know the concept of a context. I actually use the word CONTEXT in most of my scripts. And reading the BIND help (with ? bind), I see, it binds words to a known word. So I guess, the known word is defining the context, the new words (1. argument of BIND) should bind to. But why, Anton, do you use two binds in your example? I would guess, something like: do bind [code b] h/q/1 should work? | |
Dockimbel: 1-Feb-2009 | I've just hit a serious issue in 2.7.6 on UNIX platforms today. Briefly: CLOSE on TCP ports doesn't work anymore if CALL is used before CLOSE, in a AWAKE handler. To reproduce this bug, get the tests scripts here : write %server.r read http://softinnov.org/tmp/server.r write %client.r read http://softinnov.org/tmp/client.r write %foo.r read http://softinnov.org/tmp/foo.r Then, read the comment section in %server.r and launch it to see by yourself : do %server.r Notes: o Windows is not affected by this issue. o I consider this a major issue for all REBOL server applications working in async mode and spawning processes. o I'm posting first here before RAMBO, so that people can test and point out any possible bad interpretation from me. | |
eFishAnt: 16-Apr-2009 | Hmmn, I am running a script, but not as CGI, on a remote 'nix box. This script uses other scripts by 'do The main script runs, but at the first use of parse rules from a do script, it fails. Is there a magic setting of usage flags or file permissions to accomplish this? $rebol -s main.r runs main, but doesn't do the do %blah.r script from inside | |
eFishAnt: 16-Apr-2009 | It is weird, because from inside the REBOL console, a list-dir does not show the other scripts, like blah.r in the example above which main.r tries to do. | |
eFishAnt: 16-Apr-2009 | >list-dir ;after the file crashes...aha, I could see the files before doing the main.r. main.r main.r My scripts work fine on Windoze. I am now thinking from this...I do a change-directory to get the directory of where I am running and I write my data into the current directory. In Windoze, the change-directory seemed needed to pick up the directory I am in. I'll bet 'nix doesn't like that, and perhaps needs the full pathnamem from the root, or soemthing like that. | |
Ladislav: 13-Jun-2009 | BTW, (shameless plug) I am using INCLUDE instead of DO from the console when doing scripts, since I have an extensive INCLUDE-PATH, so I don't have to write the directory of the script, just its name | |
Ashley: 20-Jul-2009 | Here's the finished code (which obtains REBOL compatable font names under Mac): fonts: copy [] caps: make bitset! [#"A" - #"Z"] foreach file compose [(read %/System/Library/Fonts/) (read %/Library/Fonts/)] [ if %.dfont = suffix? file [ s: form first parse file "." parse next s [any [mark: caps (insert mark #" ") 2 skip | skip] end] insert tail fonts s ] ] remove-each font-name fonts: sort unique fonts [ (size-text make face [text: "A" font: make face/font [name: font-name size: 10]]) = size-text make face [text: "A" font: make face/font [name: font-name size: 12]] ] (the windows func to do this is http://www.reboltech.com/library/scripts/get-fonts-windows.r ) | |
BrianH: 19-Jun-2010 | Ah, but that is assuming that the code is run at the top level. Judging by that particular code snippet, it looks like something from inside a function, and one that is likely in a context has 'email? already defined. Still, the fact that INTERN is already run on normal scripts (and the module equivalent run on modules) means that he likely wouldn't need to do this with the main contexts, just inner contexts. | |
Ladislav: 14-Jul-2010 | Generallly, "preprocessing REBOL scripts" means to work with the DED, not with the DD (Do dialect) | |
BrianH: 14-Jul-2010 | The primary purpose of SAVE is to save scripts that are to later be processed by DO. | |
Gabriele: 15-Jul-2010 | The primary purpose of SAVE is to save scripts that are to later be processed by DO. - weird, i always use save and load to save and load data. but, even if that was the case, save/all would work just as well, so this is a silly argument. | |
Group: View ... discuss view related issues [web-public] | ||
Pekr: 25-Jun-2005 | Few additional notes, to not understand me wrong. I always try to see the bigger picture of things, not just from the pov of current View user. IMO VID should develop towards general "solution containers" = highering common ground for further developments. So - the solution is not to introduce one quick hack for particular style, but generalising things and letting ppl to develop their own solution, but using that common denominator. Good example is Rebol, its network protocol, and Uniserve - Uniserve is good example of taking things further, so each user does not need to start from scratch. In VID it is e.g. introduction of accessor functions. I suggest to try to find other "solution containers" :-) The other thing ppl should think openly about, is to sacrifice backwards compatibility! I do remember ppl here screaming even about single change, which would eventually broke their code. Man, it sound like some of us woul never been with bigger projects? Our SAP workflow engine is some 50K lines, and when I asked my co-worker to add another functionality, he said - I will hack-it in, but I will REWRITE whole engine to be more flexible. So - that's me and ppl I work with - let's be sane - as I stated on ML - View starts from 1.3 ;-) But even further - let's not be selfish to the thousands of ppl, which may come to Rebol in future. I don't want to explain to anyone, that thing x or y is there because there was some compatibility issue with Rebol 0000.1 alpha and som eppl got tens of scripts already - that is imo selfishness in bigger picture, sorry to say that. Use old kernels for old apps. Our code will break anyway here or there. I prefer PURITY of solution instead of compromisses. So that is my message to future developments :-) | |
BrianH: 25-Apr-2006 | Well, I want native console mode REBOL to integrate with other console mode apps and scripts, and for when I am already in console mode and need to do something without switching to a GUI. When I am in GUI mode already, the existing console is fine. I need both. | |
Geomol: 27-Dec-2006 | Do we need a "User Interface Style Guide"? It may be part of the wikibood. I came to think of it when revising some of my scripts. I often program the key "Q" to be used to quit my scripts. But maybe it should be <ctrl>-q to quit, like it is with AltME!? Then I thought about, if anyone of you has made a style guide regarding user interfaces in REBOL? REBOL/View is made for different platforms, each with their own style guides. Should we stick to those guides, so our scripts have to use different keyboard shortcuts on different platforms? No, probably not! A REBOL script should work the same across all platforms, I think. Then we need a "User Interface Style Guide", so us developers can stick to the standard when developing REBOL applications, shouldn't we? | |
Group: I'm new ... Ask any question, and a helpful person will try to answer. [web-public] | ||
Henrik: 31-May-2007 | I find myself changing the mindset with REBOL every few years, because for a long time I was afraid of for example, using PARSE. PARSE is so central and important that it can change the way you work with REBOL, if you have stayed away from it. I had the same experience when starting to use the SDK and when starting to do networking stuff in REBOL to let scripts communicate with eachother. It's not just a new set of ideas that turn up that lets me add to existing scripts, but doing the same scripts in entirely different ways. I feel I know about 30-40% of REBOL. :-) It's so damn deep. | |
SteveT: 12-Jan-2008 | Perspectives of a newbie! By Steve Thornton (SteveT) Hi! everyone, as someone brand new to REBOL I've been asked to log a journal describing my experiences using REBOL. I think the first thing to get out of the way is to tell you where I'm coming to REBOL from. I've programmed on and off for over twenty years starting with Clipper 5 (dBaseII), Visual Basic (Access), C# (SQL Server), Java(NetBeans + JavaDB). I've worked in a variety contract/freelance work. I earn approx half my income form 'Thornton Software' and I work for Iris Software Group - as a training consultant (training accountants :-\ someone has to do it!) I can hear some of you saying 'Ahh! he's an IDE wimp - real men/women code from scratch'. It was strange - every language I've used had an IDE and I was a bit put off having to go find myself an editor. Until something better find's me I'm using the freebie 'CREdit' as recommended by Sunanda. The easiest way to edit/test the scripts is to open an explorer window at the side of the CREdit window showing my scripts folder. I can then drag a .r file onto the CEdit screen and it opens it. To run the script I double-click it in the explorer window. The help and documentation available is better than I have previously experienced. Some of the components I've been wow'ed by so far is Henriks List-View and RebDb from Dobeash. I've looked at RebGUI and for the time being I would prefer not to use anything on top of VID, I need to learn pure VID before using anything else. REBOL Cookbook of examples is a useful place to start. Some more form oriented examples would be cool. Example 014 - 'Open two windows' and Example 10 - 'Simple text form window' are both useful The Event Handling guide is a good resource for programmers moving from Visual Studio etc.. That's more than enough to be going on with, next time I'll cover my experiences with VID, FACES and handling Events. Bye for now. Steve Thornton | |
SteveT: 12-Jan-2008 | Perspectives of a newbie! By Steve Thornton (SteveT) In your first steps in using REBOL (If your like me) you'll go and have a look at other peoples scripts - luckily the REBOL Viewtop is full of them. One thing that stumped me to begin with was that each developer differed slightly in how they setup their 'Layout' or 'Views' this is because there is a degree of flexibility that covers different situations. You can call a view and a layout all in one go, or you can make a layout seperately and then call it when executing the view. While I quickly understood this, I like to follow 'best practice' when creating the initial framework of my application. It would be a great help if a diagram was available showing where to place things. For example I went wrong by trying to place view options/effects inside the layout structure, When you look at some of the one/two line examples it looks as if you can do that. Steve | |
mhinson: 13-Apr-2009 | Another (maybe foolish) question please. I am trying to use this script to help me understand the use of parsing to extract data from files. If I paste the script into my REBOL/View console it pastes in the script ok, but the examples do not work. This seems very common with a lot of the scripts in this library and is a problem I have been fighting with for several days. This is what I get. >> ini: parse-ini-file %/c/windows/win.ini ** Script Error: Out of range or past end ** Where: parse-ini-file ** Near: append last current-section parsed-line/1 append >> Am I pasting the script & examples to the wrong type of console or something? I feel it must be something I am doing as so few of the example scripts work for me. Thanks, /\/\ | |
Gregg: 22-Dec-2009 | Yeah, R2 isn't great for creating "slick" interfaces without the use of graphics. Use can draw text with anti-alias, but most scripts just do things the easy way. The pencil icon is handy as well, so you can use ctrl+s to send. I imagine you've already done that, but for others listening in... | |
Henrik: 21-Jun-2010 | I think the point there was that you have an open console, and then DO those scripts from that console. That has the intended effect. | |
Henrik: 21-Jun-2010 | >> do http://www.rebol.org/library/scripts/helloworld.r connecting to: www.rebol.org Script: "Great Computer Language Shootout : hello" (27-Sep-2005) hello world | |
Group: Parse ... Discussion of PARSE dialect [web-public] | ||
Steeve: 8-Nov-2008 | 2, 3 tips I know that Brian is great contributor but I think sometimes it tends to reject a bit too easily ideas of others. Why I am saying this, is that I am not always convinced by his arguments but he acts as if the issue was resolved in advance. (I may have a problem with that) About who is credited with what, I think that this is not important too, however it was a bit of supris seeing the name of Brian on most of the ideas, then as I said previously, this makes many years that these Improvements have been suggested by different people. Obviously this is not an important step, but Brian, you puting your name everywhere pretexting you collect ideas is a little ... how to say that ? pretentious. Personally, I am a large user of parsing. I think this is the most important function in Rebol. You can do practically everything with it. Design dialects, interfaces, and many others things. Parse can build programs by clearly showing the data structures your are dealing with. Thus our scripts win in readability. During all these years, I was very frustrated seeing some limitations. I thought, oh my God, if only we could do this simply, REBOL would be so powerful. My view is that parse should be extended (as far as possible) to gain in expressiveness. One thing I don't like with parse, is the cumbersome process to pass parameters to functions. I give an example. usually we do: [copy parm my-rule (my-func parm)] If parse knew recognize when to call a function we could write: [Myfunc my-rule] This would be much more compact and expressive. More, we could use return value of myfunc to guess if the parsing should continue or not. This development would discard most of proposals that were made because we could add many new commands very easily. (IF NOT ALL RETURN etc ...) | |
Steeve: 6-Oct-2009 | Guys, i think your opinion about NOT is a little harsh. In the case of complementing a charset, you just have to SKIP after the NOT rule. In the other cases, not advancing is of better use. At least that's what I see while rewriting some scripts as I do now. | |
Henrik: 17-Oct-2009 | Do we have a list of PARSE changes that are no longer compatible with R2? I think that would be important in porting parse scripts from R2 to R3. | |
Group: Syllable ... The free desktop and server operating system family [web-public] | ||
ddharing: 28-Aug-2010 | I have a looming project with Glad where this can be deployed. I'll be doing some extended load testing next week to see how our services run and verify the server's stability. These days a lot of software gets used for years and never makes it to 1.0. I'm running REBOL scripts, sqlite and Cheyenne. We'll also be using another third-part y so library for PLC communications. Kaj, do you feel confident in Syllable Server's present state to run this kind of workload. I'm just looking for a personal opinion, of course. The ultimate decision and responsibility is mine. From the customer's perspective, our product is an embedded system running a custom version of Linux. | |
Group: Linux ... [web-public] group for linux REBOL users | ||
Robert: 4-Oct-2008 | Which leads me to the next question: How do you handle Rebol scripts that are used on Windows and Linux regarding returns? Do you just use the LF or CRLF or CR (OSX)? | |
Henrik: 4-Oct-2008 | by handling, do you mean running? because rebol on linux would not have any trouble running scripts written in windows notepad. | |
Henrik: 4-Oct-2008 | The launch environments are different in that the shebang path is used by the shell to know what to do with the script. You can also run a REBOL script in the linux terminal with: rebol -qs script.r and it will be the same script as under Windows. It might look a little ugly, but you could wrap your windows REBOL scripts in a shebang script. | |
Group: Web ... Everything web development related [web-public] | ||
Sunanda: 20-Sep-2006 | Louis -- a couple of pointers about uploading files to a server using a slow FTP connection: (I do it myself with REBOL.org -- most of the development takes place on my machine and is uploaded to RO via a 56K modem, so this is based on real experience.) -- If you are uploading a large live file, that file will be available and/or "broken" during the course of the upload. Best to upload with a temporary file name, and then rename when uploaded. -- That won't work with CGI scripts under Apache/UNIX as the rename won't leave them with the right file permissions to execute. But it will work for all other files, including scripts that are DOne by your CGIs. -- We have a checksums file that the uploader uses. Before uploading a file, it checks the file's upload checksum. That way, we only ever upload new or changed files. | |
Group: Announce ... Announcements only - use Ann-reply to chat [web-public] | ||
Carl: 8-Jul-2005 | I would like your permission to publish some of the groups here on R3 to the web site. See: http://www.rebol.net/article/0183.html The only groups that will be published will be those that have descriptions that contain the string [web-public]. If I do not hear any objections (post them to "Carl Only" group), I will fire up the scripts and get this started. | |
Henrik: 28-Sep-2006 | HTTP Tools. A small script containing a few functions to read the HTTP header of a webserver. It doesn't do much, but the main purpose is to determine which scripting language is used on a specific webserver. I use it to upload ASP and PHP scripts to various webservers, without having the user needing to know the scripting language in advance. It's not very strong yet and some servers will not reveal this information, but I hope it can be built into a reliable tool for determining scriping language over time. http://hmkdesign.dk/rebol/http-tools/http-tools.r Example: >> server-type http://rebol.com == "Apache" >> x-power-type http://www.hmkdesign.dk == "php" >> x-power-type http://www.microsoft.com == "asp" | |
Gregg: 13-Jun-2009 | INCLUDE is very nice. What I think it still missing from the wiki are cons about the lower level alternatives with regard to higher level "standards". e.g. with LOAD and custom scripts you can do anything, sure, but there is no standard model, so each system is ad hoc. | |
Group: SDK ... [web-public] | ||
Henrik: 6-Feb-2009 | they already do. you can do all this the same way in R2 by going to the console and typing: do http://www.somewhere.com/script.r the browser will just present the scripts a little differently. | |
amacleod: 3-Mar-2009 | Having the same problem with scripts...mysql-protocol.r ** Access Error: Cannot open /C/Documents and Settings/Alan/Desktop/mysql-protocol.r ** Near: do %mysql-protocol.r db_IP: mysql://Alan:[Stynki4-:-onfire-:-selfip-:-com]:3306/onfire do | |
Gregg: 22-Sep-2010 | Yes, I never do that Henrik. I've used a number of systems over the years (I think I posted my enlist script on rebol.org), and now generally use build and encap scripts, with Ladislav's INCLUDE as the foundation. In the encap script I include all the reshacker stuff to set the icon and version info. | |
Group: !RebGUI ... A lightweight alternative to VID [web-public] | ||
Ashley: 30-Apr-2006 | Do you have published the build-script that creates rebgui.r? REBOL [] ; combine source scripts do/args %prerebol.r [%rebgui-ctx.r %tmp.r] ; remove header save/header %tmp.r load %tmp.r [] ; remove indentation do/args %prerebol.r [%tmp.r %rebgui.r] delete %tmp.r ; remove newlines and surplus spaces gui: trim/lines read %rebgui.r ; compact block delimiters replace/all gui "[ " "[" replace/all gui " ]" "]" replace/all gui " [" "[" replace/all gui "] " "]" ; compact expression delimiters replace/all gui "( " "(" replace/all gui " )" ")" ; final write write %rebgui.r gui | |
Ashley: 1-May-2006 | Yes, once you do an "SVN Checkout" the folders and files are displayed with a green tick. Editing a file causes it (and the folder it appears in) to be displayed with a red changed icon. Right clicking the root folder, RebGUI in my case, and selecting "SVN Commit" prompts for which changed scripts (and a comment) you wish to save back. Pretty straight forward once you've done it. | |
Pekr: 20-May-2006 | well, you can always state anything. Being a developer's tool does not tell anything how ppl are using Rebol to develop. I am not comfort with idea of installation, simple as that. I never use double-click to launch my scripts and never will do, untill we get one exe and components (file associations issue). And noone should explicitly tell, how do I use any tool. | |
Ashley: 27-Jun-2006 | Gordon, the demo directory and scripts (bubble-menu, list-view & triggers) were part of earlier releases. The directory was removed when the source was migrated to SVN, and all non-stable widgets (including list-view, bubble-menu and a few others) were removed. There is no need to "do %rebgui-widgets.r" as this is included directly in the new merged %rebgui.r script (and invoked from %rebgui-ctx.r if you run from the SVN source direct). LIST-VIEW is an important widget which we are hoping Henrik will be able to port to RebGUI from the excellent work he has done on this already. | |
Ashley: 9-Mar-2007 | I think we drift to far away ... depends on the extent to which you have changed/enhanced core RebGUI functionality (e.g. rebgui-*.r scripts). If most of your changes are isolated to new/enhanced widgets then there is really no drift; you can plug your widgets into the standard RebGUI engine and it will all work. If you want to keep your changes in sync then I suggest 2 simple practices: 1) If you need a version of a standard widget (e.g. radio-group) to do things that are app or design philosophy specific then create your own widget instance and suffix it with an identifier, say XP for XPeers in your case (e.g. radio-groupXP). Suffixes are preferred over prefixes as the alphabetical sort order of the widgets determines their load order which may affect dependencies ... see text.r and label.r for examples of this. 2) Only keep and maintain a divergent Widgets directory ensuring that your widgets continue to work with the standard RebGUI engine (i.e. rebgui-*.r scripts). If you need the base engine enhanced (e.g. to support tool-tips or proportional resizing) then let's isolate those changes and get them into the base distribution. You should be able to create and maintain your own widgets without worrying about divergence as most of the design effort should be going into the functionality of the widget(s) themselves. If your widget needs specific changes/enhancements to the base engine then we need to sync those changes at the point you need them. Trying to retrofit these after the event, and after multiple divergent engine changes, is going to cause problems as you've discovered. From my end, the 3 major changes you should probably try and work back into your fork are: 1) UI settings: mostly confined to rebgui-ctx.r 2) rebind func added to all widgets prior to init and rebgui-widgets.r enhanced 3) tab-panel rewritten to operate significantly more efficiently (tab-panel.r and associated rebgui-edit.r changes) | |
Ashley: 24-Dec-2007 | was it deliberate decision to remove the functions tab from tour.r Yes, RebDOC now covers the same ground. My goal is to pull the content across from %tour.r into RebDOC and then obsolete it (%tour.r that is). In RebDOC the examples will become stand-alone scripts. RebGUI Core ... I like it, and it means we can distinguish general RebGUI app issues from RebGUI Core issues (e.g. keyboard navigation is a core issue, lack of a domain specific "bells & whistle" widget a RebGUI app issue). For me the line is quite simple: if it is an issue that can be fixed by creating a new widget (either from scratch or based on an existing one) then it is probably an app issue; if it is an issue that effects most if not all widgets and / or the fix is to the RebGUI engine itself (e.g. a %rebgui-* script) then it is probably a core issue. request-dir function has lost the home" button" ... yep. The old request-dir function was dynamic and only read dirs as needed. The new one, due to the "static" nature of tree, pre-reads all dirs. It's also lost the "make dir" button. These features maybe important to us as developers, but if users need to navigate the entire file system or create dirs to use an app then the native request-file is probably a better choice. The [new] request-dir is really intended for the simple "which of these directories or sub-directories do you want to use" case, and assumes the developer will use the /path refinement to start in the relevant directory. These changes were requested by one of my clients who didn't want their staff "seeing stuff they shouldn't and creating directories everywhere". neat scroll-panel now means I can have enormously wide tab-panels ... I had that in mind when I created it! Note that the horizontal and vertical sliders only appear as needed and the space they occupy is given back to the child widget. Also note that the button on the extreme bottom right of scroll-panel toggles between "home" and "end". | |
Ashley: 22-Oct-2009 | re: RebGUI and R3/VID. I'll probably put something up on my website on this topic as I get asked this quite a lot. Basic thinking at this stage is: I need to create SDK GUI apps for Windows and OSX R2/RebGUI is the only practical alternative at present for *me* I'd love to use R3/VID to create SDK GUI apps today This probably won't be possible for quite some time If and when this *is* possible I'll port all my apps over to R3/VID To do this I'll either create a compatibility layer that lets RebGUI apps run on R3/VID, or Write a conversion script that tries to convert (if possible) RebGUI scripts to R3/VID I'd hope R3/VID is complete enough that it doesn't require any of RebGUI's basic widgets! | |
Group: DevCon2005 ... DevCon 2005 [web-public] | ||
eFishAnt: 14-Oct-2005 | Brett, I also grokked Gregg's "turtle" hunting metaphor. Already I have filled more than a page of inspirations from it. Here is a sampling of my found design patterns, mostly in REBOL which are powerful "turtles" which are concrete examples of what Gregg said: 1. View console where a user can type VID/View lines, and hit return to see what they do. 2. Using print statements to the console from a View script to understand it (so easy to do protytping) 3. Parts of layout.r IDE with Nubs, and you generate scripts (which are human readible) from the GUI. 4. The source and help systems built-in to REBOL 5. Arexx for Inter-App-Messaging (I listened intently to Gab's Reb/Services talk saying "Arexx of the X-Internet") 6. awk file parsing. (I know Gregg wrote rawk.r a while back) ... "Turtle hunting" challenges us to develop more of these. | |
Group: Rebol School ... Rebol School [web-public] | ||
Henrik: 8-Feb-2009 | kib2, you'll find that many scripts come wrapped in contexts. this is the best we can do until R3 brings us modules. contexts are not waterproof, though. | |
BrianH: 15-Mar-2010 | In R2 DO of a block or string didn't require (or use) the header, but DO of a script does. In R3 it's the same for DO of a block, but strings are treated like scripts now, and the header is optional, unless you need information in it. So DO script has a 'rebol keyword, but DO block doesn't. And DO block is what we think of as being the DO dialect. | |
Marco: 21-Aug-2011 | @shadwolf Perhaps it's a pain to submit a script to rebol.org cause you have to exactly properly stupidly and exactly submit the header !!, but if you kindly do that you can share your good scripts with others who can learn from them (this is Rebol school ;) ) and more progress in rebol will be done. Better not hope in others to follow our advices (or answer our questions) | |
Group: rebcode ... Rebcode discussion [web-public] | ||
Jerry: 21-Oct-2006 | REBCODE is AMAZING ... I am trying to convert a 300+ MB file from little-endian 16-bit Unicode to UTF-8. I am pretty sure that all the characters in this file are ASCII characters, so I can just discard the second byte (0x00) of every 16-bit Unicode character. Beside that, the beginning 2 bytes (0xFFFE) need to be discard too. In these two days, I wrote REBOL scripts for this purpose in different ways, and I suffered in different ways, too. Sometime I got out-of-memory error, sometimes I didn't. Even if I didn't get any error, the performance would definitely dramatically dropped down after few minutes because of the memory issue, I guess. I would take me 30 minutes to convert the file in my PC. I was trying to make it less than 10 minutes, so I kept asking stupid questions in the AtlME REBOL3 World. Few ours ago, REBCODE came to my mind out of the blue. I remembered Carl said something like 10-30 faster. Because I am no REBOL expert, I'd never used REBCODE before. I took 1-2 hours to read the REBCODE document, then I do my very first REBCODE code in my life. Guess what? It turned out very well. The REBCODE version took only 45 seconds. It's AMAZING. | |
Pekr: 15-May-2007 | ok - different pov - do you expect current VID scripts to run with View 1.3? Will you "emulate" face aproach, etc.? | |
Group: Tech News ... Interesting technology [web-public] | ||
btiffin: 8-May-2007 | Ladislav; I can't give you much of a 'technical' report, but I tried to break the include sequences and failed. I'm starting to feel the power of this. I like the fact that scripts can end with context [#include %libfuncs.r] to let endusers pick their own name with mycon: do %libouts.r after an include/link Very nice. An easy grok, and I'll say I "get it" already and won't have to read your docs over and over to actually use it. (Well except maybe to refresh the #do [[ and (#do [false]) tricks, if I don't use them soon.) This really needs to be promoted. Here's hoping the DevCon talk gets this into the fore. | |
BrianH: 3-Sep-2008 | That would be nice (especially for us if you were to do so, given what you have written so far). Still, you should write to the strengths of the tool. I actually come pretty close right now - Much of the code I write in other languages is actually generated by REBOL scripts, something I would never dream of doing in Java. | |
Reichart: 21-Jan-2010 | Sikuli is intersting.... reminds me of a thing on the Amiga called Madala... where you could write scripts as I recall that were visual, to do actions based on what it found under hot points. You could for example select a region, it would use a simple OCR to read that region, and then, if let's say a word or number was reached, like let's say a counter that you knew was sending 10,000 files reached 9,900, you could have it play a sound, so you could know it was done.... Would prefer a better version where you can simply pipe all text or widgets to other places. Wouldn't it be cool if you could "pull" like a sticker a widget from one place (an application or even website) and "stick it" on some other place, like your dashboard or toolbar somewhere else?. Is there really any reason I should not be able to take some group here in AltME, pull it "Tech News" over to my Googl page, which I look at a lot, and when somoene posts here, I see it turn red "there". | |
Group: !REBOL3-OLD1 ... [web-public] | ||
Karol: 20-Apr-2006 | I found learning rebol very easy because of it is just about words if you know 50 words you can write script if you know 200 you do it better. All those namespaces, dictionaries, classes ,trees or whatever does not help in writing programms and you need to remember more things. Using rebol is like using foreign language. Rebol has contexts and dialects for changing meaning of word. Maybe every script should work in its own context from default? I notice that many scripts are written in that way with use of 'set to put something to global context. And to be practical I use editor with syntax highlighting so every word from global context (set only) are blue so i can easly see if I redefine global word - after all it's just warning like in any language | |
Maxim: 13-Feb-2007 | geomol and others... INC with lit-words is seriously flawed in actual use ... a: inc a ?? what's the point of it... lit-words are not word values they are labels, they are not usable unless the word exists "somewhere else" its not THE a you are evaluating but AN a somewhere... which is why this is as alien to rebol as anywhere else. if all series can change values "in-place" like append... why not allow this for scalars (and others) too? its already an integral part of REBOL ... I don't see the "confusion" in INC a changing THE a... its exactly like append a, but for another type... hell, I've wanted in-place editing for many things which aren't series and it would speed up code, just like not having to copy series all the time like python. ADD-TO a 10 when you do INC 'a you HAVE to declare 'A somewhere else... which is not in rebol's philosphy. this is completely different thinking to rebol... its much closer to C style... where you expect a to exist somewhere... the lit word syntax, just cause a big confusion within the normal chain of rebol coding IMHO its not simple, and certainly not obvious... most newbies don't even get what a lit-word is. just like SET which is used only (usually) to implement other tricks in the language... we shouldn't be using SET in normal code. INC is not a trick word... its something I'd be using in many scripts, unlike SET which I seldom need to. just giving my view on this topic. ;-) | |
Gabriele: 22-May-2007 | all my scripts start with a rebol header.... do won't execute them otherwise :) | |
Geomol: 23-May-2007 | I understand, that REBOL3 won't be 100% compatible with earlier versions, so some scripts will eventually crash. I also understand the reasons for this decision, the urge to get everything as 'right' as possible, that the language concept for REBOL is so inventing as it is, etc. But for larger projects, developers making libraries etc., this is not a good thing. Are there any plans around this problem for the future? Maybe compatibility modules is a possibility? Or will that be very hard to do, because it might lead to a mixture of old and new code? | |
Henrik: 30-Jul-2007 | brian, I'd start adapting simple scripts from R2 to R3. Do that by adding multithreading, adapting to async HTTP, etc. | |
btiffin: 15-Oct-2007 | Izkata I agree about readability. A symbol may suffer abusive 'coding' practice if it ends up being last-expression and not just last-console-expression and then people do use the feature in scripts. | |
BrianH: 14-Dec-2007 | UTF-8 is a strict extention of ASCII, but ASCII is only defined between 0 and 127. Characters 128+ are not ASCII, they are extensions, and their meaning depends on the codepage. The codepage of an 8-bit string is unknown, unless you specify it externally (or do a lot of statistical calculations). Strings or scripts with characters extended by a codepage will have to be translated by a codepage-to-utf-8 function or process specific to the particular codepage, ahead of time. Fortunately, such a process can be fast and even implemented in a byte-oriented language easily. | |
shadwolf: 8-Aug-2008 | I HATE VISTA AND I DON'T DO ANY VISTA FRIENDLY REBOL SCRIPTS :P | |
Henrik: 19-Sep-2008 | The browser as the launch platform for applications has always been an interesting idea. The fundamental problem of the sheer complexity of it can be solved with R3. If done right, it can completely wipe the floor with browsers and AJAX. I think the problem is that we haven't been speaking in a language that people can understand, such as "browser", "web2.0" and "webserver", but instead "dialects", "VID", "Viewtop" and "X Internet" and people go "huh?". Some things I believe are needed to do this right: - Browser form factor. People are used to browsers, not Viewtops. What's always the first thing a complete newbie computer user uses, when wanting to do anything on the internet? A webbrowser. I don't want a desktop inside my desktop. There are tens of solutions for such things and they are almost all forgotten. Carl is doing the REBOL browser. When you fire up R3, you will get what looks like a webbrowser and acts like one. The concept has to work equally well for people like us, as well as 5-year-olds and 95-year-olds. - Do apps that are similar to webapps, like GMail. That's a quick way to compare. Don't you think a 50k GMail look-a-like inside a REBOL browser running at native speeds would be _slightly_ impressive? Remember to say that you can serve 5 times more users with the same bandwidth. REBOL can help make raw numbers look better without much effort. Google would have to use it as a content platform. They have no other choice. :-) Chrome? What's that? - Plugins suddenly are very flexible. You don't have plugins as in Firefox, but helper scripts that can enhance/change your browsing experience. 15k full screen document reader that prettifies plain text files? Sure thing. Blog posts presented in that would be much nicer to read. Out goes the PDF reader. - Do apps that are completely out of the league of AJAX, such as multithreaded P2P systems. In fact, why not build P2P capabilities right in? Have different instances of the browser allow users to connect and chat, when they are visiting the same "Rebsite". It's sort of like going into a physical store and chatting with the other customers and you decide to exchange business cards. Initial contact without needing email. Do the same thing with chat support for an article that you bought at that "rebsite". Current websites are almost completely anonymous. You don't feel you are entering a live community. Coded in REBOL/Services. - Webpages are now REBOL scripts. In R3, scripts can be closed and encrypted, so you can't read the source and you can sell scripts and have them signed. The best you can do right now is some kind of code obfuscation. - Windows, MacOSX and Linux version. - "A webbrowser that directly supports OpenGL without obscure/limited 3rd party plugins." Say that again in your head. - It's very important that the public get to see that creating REBOL scripts for the browser is very similar to creating plain HTML pages. REBOL scripts can be served off a plain webserver. All the infrastructure is already there. Or how about serving scripts from the browser itself? AltME can both be a client and a server. It's that P2P thing again. - Browser would run wherever R3 runs. - Market it as Web 4.0. Market it as a direct competition to current webbrowsing. - Browser would be a 500-600 kb downloadable exe that starts immediately without installation. From deciding to get it, to be using it to browse "Rebpages", it should not take more than 30-45 seconds. - We need AltME in that browser (Altissimo?) as well as QTask. For developers: - It's easy to create an HTML file in notepad and display it in your favourite browser. It's going to be equally easy to create a REBOL script in notepad and see it running in your REBOL browser. A 5-year-old who has just learned to type, should be able to create a script and display it. - One language for everything. - Everything is free. You can start out with notepad. The barrier for creating content is about as low as it can get. - You wanna code slow web 2.0 apps or fast web 4.0 apps? Hard choice, I know. | |
Pekr: 21-Sep-2008 | I think we should wrap some services. Do you remember few scripts, wrapping SlashDot? What about wrapping Google mail? And then showing the source code of VID? I think it could cause some jaws drops, how small the source can be. Then we could encap it, and provide it as a Flash app. It could be downloaded in millions. And Google might get interested. They imo need something against Flash/Silverlight, and there is not third technology to the game but REBOL imo ... | |
Henrik: 22-Oct-2008 | Code example: do %load-gui.r files: read %*.r view/options [ tight [ text-list files do [set-face ca read-string pick files value] scroller ] ca: code-area ][ title: "REBOL Scripts" columns: 0 ] Produces http://rebol.hmkdesign.dk/files/r3/gui/036.png | |
[unknown: 5]: 6-Jan-2009 | Does anyone know if REBOL3 will include REBCODE functionality? If not, then it would be cool if we could DO rebcode from a REBOL3 script somehow. Such as DO %rebcode.bin to give us the functions of REBCODE to use in our scripts. | |
Steeve: 12-Mar-2009 | i make a proposal: Most of the times, we use the same rules several times on different data. reword should be able to not reconstruct the rules if so. I used the similiar tricks in some scripts, for example: map-chars: func [ {replace/all pair chars in a string} data [string!] values [block!] /local chars pos ][ ;** if the first value in values is a bitset, do not reconstruct the bitset unless bitset? chars: first values [ chars: make bitset! 256 forskip array 2 [append chars array/1] insert values chars ] pos: data values: next values while [pos: find pos chars][pos: change/part pos select/skip values first pos 2 1] data ] data: "Hello You" map-chars copy data values: [#"s" "SS" #"t" #"T"] ;** the second call is faster map-chars copy data values | |
Ammon: 10-Apr-2009 | Ok, good enough. I think that will work. I'll modify some of my scripts to use that method and then do some benchmarks... | |
PatrickP61: 12-Apr-2009 | I have thought of using user.r or Rebol.r as a way to run a script to log my execution of scripts, although I have not done so. I tend to think of those two items as a "hook" where I can execute my own generic code for whatever purpose needed. I have often thought of having either Rebol.r or User.r enforce protect on system words and then make sure Rebol.r or User.r is read only, but there may be other ways to do this better. I am still new to rebol. | |
Pekr: 12-Apr-2009 | BrianH: I don't agree to your nor Carl's reasoning towards patches: 1) I use custom patch for URL ftp format, which goes probably anti RFC, but is very practical (@, # in username). Putting those things into DevBase is nto an option - it would not be accepted 2) As Carl suggested, building custom rebol.exe is not an option too, because - I don't want tonnes of various rebol.exes around, one adding this thing, another one changing the other thing. 3) This whole thing is not a big deal, I just will have to add do %my-init.r into the beginning of each of my scripts, which sucks though ... | |
Steeve: 28-May-2009 | Actually, the first optimization i do in my scripts which need speed and low memory usage, is to remove all the reduce and compose usage. It's always the first thing i do | |
Anton: 24-Aug-2009 | Not just for the os shell which has launched rebol, but rebol scripts that do other rebol scripts - the DO could be considered like a function call, and the DO'ed script could RETURN just as if it was a function. The attractiveness of the idea is that there is just one function (return) to learn which handles the same concept (returning) in different contexts. | |
PeterWood: 30-Sep-2009 | REBOL3 cgi scripts don't work on Windows (under Apache or IIS) but do run on OSX (under Apache). | |
Gabriele: 1-Nov-2009 | Max, maybe i was not clear. If your rebol scripts are latin1 by default, while my rebol scripts are utf-8 by default, when i send you a rebol script IT WILL NOT WORK in the same way in your machine. the *script*'s encoding *must* be a standard everyone agrees on. then, the script can do whatever it wants with the data, it's your fault if you make it so data cannot be exchanged easily among systems. | |
BrianH: 1-Nov-2009 | One interesting thing about R3 scripts is that they are UTF-8 *binary*, not converted strings. A header setting would just require R3 to convert the script to string! and then back to UTF-8 binary before reading the file. This is why we recommend that people DO [1 + 1] instead of DO "1 + 1", because that string needs to be converted to binary before it can be parsed. | |
Group: !Cheyenne ... Discussions about the Cheyenne Web Server [web-public] | ||
Terry: 9-Oct-2008 | REBOL/Plugin includes a function callable from REBOL scripts, do-browser, that allows you to execute and retrieve the result of browser script code. This script code may manipulate the browser's document object model (DOM), giving you the ability to interact with other elements in the HTML page. | |
Dockimbel: 15-Dec-2008 | Btw, if your %tag.r script is required in most of your RSP scripts, just DO it once in 'on-session-start (in %app-init.r). | |
Dockimbel: 18-Feb-2009 | Oldes: Graham is using CALL from RSP scripts to do image processing IIRC. I never used CALL from RSP myself, so I can't tell. It seems to me that it would be faster/safer to wrap an image processing DLL than launching a new process for each new request. Using CALL from a RSP is like dropping to CGI, you're loosing most of RSP speed benefits. | |
Dockimbel: 3-Mar-2009 | In theory, it should be possible to set to none each new webapp variables used in RSP scripts by querying the webapp context object. In practice, I'm not sure it can be made 100% reliable because you can always declare words using SET in global context (which would be much more difficult to clean up without breaking the RSP engine). The other reason is that, as a side effect, it allows some dynamic code caching like this one : <% if not value? 'my-lib-loaded? [ do %private/my-lib.r my-lib-loaded: yes ] %> This can be used when you don't want to pre-load some libs from the on-* handler, but load them dynamically, only when needed. So you pay the cost of loading only once for each RSP process when the script is first called (and you can clean it when no more required by, for example, setting the word referring to the lib context to none) | |
Maxim: 13-May-2009 | the main job will be to do build a set of tags which provide easy .net type form post back handling, without the need to have 15 scripts or excessively complex php-like scripts to properly handle form data. | |
Janko: 16-May-2009 | aha, mine is reverse, no stress testing but functionality... I made it for webapps but with it you could also do automated testing on a sample of scripts and see at any point if all the features work .. it is very much in devel still ... I used it for testing site-assistant but it's more manual at this point.. I will impove it as one of my clients needs it for their app. I hope it will be more edible or usable soon, I will show it to you then. | |
Dockimbel: 21-Jul-2009 | Word capturing => yes, all RSP running inside a webapp are captured in the webapp execution context, to avoid global context pollution. This doesn't apply to standalone RSP scripts (outside a webapp), but that feature could be easily added. Page inclusion => yes, you can include RSP scripts in RSP. See http://cheyenne-server.org/docs/rsp-api.html#def-21 context injection with captured" words on the subpage" => I don't understand precisely what you describe here. In Cheyenne/RSP, subpages are captured in the webapp unique context, like parent pages, so there's no special treatment for subpages. Do you imply exporting just a selected list of words from the subpage script to the parent context? |
101 / 254 | 1 | [2] | 3 |